Skip to content

Commit

Permalink
Move Node tests on Windows to Travis (#1063)
Browse files Browse the repository at this point in the history
* Move Node tests on Windows to Travis

Appveyor is flaky and can't be restarted by all team members, so moving
everything to Travis is preferable if we can get it to work.

* Actually use latest stable Node

This should also workaround the issue with lts/* not working on
Windows.

* Use npm.cmd instead of raw npm on Windows

* Use p.prettyUri() for Node API tests

Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
  • Loading branch information
jathak and nex3 committed Sep 8, 2020
1 parent a062954 commit 830bb3a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Expand Up @@ -73,14 +73,10 @@ jobs:
# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated April 2021. See
# https://github.com/nodejs/Release.
#
# TODO(nweiz): Run Node tests on Windows when [this issue][] is fixed.
#
# [this issue]: https://travis-ci.community/t/windows-instances-hanging-before-install/250/28.
- &node-tests
name: Node tests | Dart stable | Node stable
language: node_js
node_js: lts/*
node_js: node
install: pub run grinder before-test
script: tool/travis/task/node_tests.sh
- <<: *node-tests
Expand All @@ -89,6 +85,8 @@ jobs:
- <<: *node-tests
name: Node tests | Dart stable | Node Erbium
node_js: lts/erbium
- <<: *node-tests
os: windows
- <<: *node-tests
os: osx
- <<: *node-tests
Expand Down
21 changes: 0 additions & 21 deletions appveyor.yml

This file was deleted.

9 changes: 5 additions & 4 deletions test/node_api_test.dart
Expand Up @@ -18,6 +18,7 @@ import 'hybrid.dart';
import 'node_api/api.dart';
import 'node_api/intercept_stdout.dart';
import 'node_api/utils.dart';
import 'utils.dart';

String sassPath;

Expand Down Expand Up @@ -294,7 +295,7 @@ a {
"1 │ x {y: }\n"
" │ ^\n"
" ╵\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});
});

Expand Down Expand Up @@ -369,7 +370,7 @@ a {
"1 │ a {b: }\n"
" │ ^\n"
" ╵\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});

test("sets the line, column, and filename", () {
Expand Down Expand Up @@ -420,7 +421,7 @@ a {
'1 │ a {b: 1 % a}\n'
' │ ^^^^^\n'
' ╵\n'
' $sassPath 1:7 root stylesheet'));
' ${prettyPath(sassPath)} 1:7 root stylesheet'));
});

test("sets the line, column, and filename", () {
Expand Down Expand Up @@ -494,7 +495,7 @@ a {
"1 │ a {b: }\n"
" │ ^\n"
" ╵\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});
});
}
4 changes: 4 additions & 0 deletions test/utils.dart
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:convert';

import 'package:path/path.dart' as p;
import 'package:test/test.dart';

import 'package:sass/src/io.dart';
Expand All @@ -31,3 +32,6 @@ Map<String, Object> embeddedSourceMap(String css) {
expect(data.mimeType, equals("application/json"));
return jsonDecode(data.contentAsString()) as Map<String, Object>;
}

// Like `p.prettyUri()`, but for a non-URL path.
String prettyPath(String path) => p.prettyUri(p.toUri(path));
3 changes: 2 additions & 1 deletion tool/grind.dart
Expand Up @@ -72,7 +72,8 @@ void format() {
}

@Task('Installs dependencies from npm.')
void npmInstall() => run("npm", arguments: ["install"]);
void npmInstall() =>
run(Platform.isWindows ? "npm.cmd" : "npm", arguments: ["install"]);

@Task('Runs the tasks that are required for running tests.')
@Depends(format, synchronize, "pkg-npm-dev", npmInstall, "pkg-standalone-dev")
Expand Down

0 comments on commit 830bb3a

Please sign in to comment.