Move Node tests on Windows to Travis (#1063)

* 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>
This commit is contained in:
Jennifer Thakar 2020-09-08 09:23:46 -07:00 committed by GitHub
parent a06295426d
commit 830bb3aab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 31 deletions

View File

@ -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
@ -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

View File

@ -1,21 +0,0 @@
build: off
branches:
only:
- master
# Feature branches beginning with "feature."
- "/^feature\\..*/"
# Semantic version tags and legacy branches of the form "1.2.x".
- "/^\\d+\\.\\d+\\.(\\d+([+-].*)?|x)$/"
install:
- choco install dart-sdk
- refreshenv
- pub get
- ps: Install-Product node ''
- pub run grinder pkg-npm-dev
- npm install
# Only run Node tests on Windows because they won't work on Travis. See
# https://travis-ci.community/t/windows-instances-hanging-before-install/250/28.
test_script: pub run test -t node

View File

@ -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;
@ -294,7 +295,7 @@ a {
"1 │ x {y: }\n"
" │ ^\n"
"\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});
});
@ -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", () {
@ -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", () {
@ -494,7 +495,7 @@ a {
"1 │ a {b: }\n"
" │ ^\n"
"\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});
});
}

View File

@ -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';
@ -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));

View File

@ -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")