Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Test for different errors in Dart versus JS
  • Loading branch information
nex3 committed Apr 3, 2019
commit 848f73a54870ac29da91ed1964165442a6c04c50
18 changes: 18 additions & 0 deletions test/cli/dart/errors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,29 @@
@TestOn('vm')

import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;

import '../dart_test.dart';
import '../shared/errors.dart';

void main() {
setUpAll(ensureSnapshotUpToDate);
sharedTests(runSass);

test("for package urls", () async {
await d.file("test.scss", "@import 'package:nope/test';").create();

var sass = await runSass(["--no-unicode", "test.scss"]);
expect(
sass.stderr,
emitsInOrder([
"Error: Can't find stylesheet to import.",
" ,",
"1 | @import 'package:nope/test';",
" | ^^^^^^^^^^^^^^^^^^^",
" '",
" test.scss 1:9 root stylesheet"
]));
await sass.shouldExit(65);
});
}
18 changes: 18 additions & 0 deletions test/cli/node/errors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@Tags(['node'])

import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;

import '../../ensure_npm_package.dart';
import '../node_test.dart';
Expand All @@ -14,4 +15,21 @@ import '../shared/errors.dart';
void main() {
setUpAll(ensureNpmPackage);
sharedTests(runSass);

test("for package urls", () async {
await d.file("test.scss", "@import 'package:nope/test';").create();

var sass = await runSass(["--no-unicode", "test.scss"]);
expect(
sass.stderr,
emitsInOrder([
"Error: \"package:\" URLs aren't supported on this platform.",
" ,",
"1 | @import 'package:nope/test';",
" | ^^^^^^^^^^^^^^^^^^^",
" '",
" test.scss 1:9 root stylesheet"
]));
await sass.shouldExit(65);
});
}
17 changes: 0 additions & 17 deletions test/cli/shared/errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,4 @@ void sharedTests(Future<TestProcess> runSass(Iterable<String> arguments)) {
expect(sass.stderr, emitsThrough(contains("\.dart")));
await sass.shouldExit(65);
});

test("for package urls", () async {
await d.file("test.scss", "@import 'package:nope/test';").create();

var sass = await runSass(["--no-unicode", "test.scss"]);
expect(
sass.stderr,
emitsInOrder([
"Error: \"package:\" URLs aren't supported on this platform.",
" ,",
"1 | @import 'package:nope/test';",
" | ^^^^^^^^^^^^^^^^^^^",
" '",
" test.scss 1:9 root stylesheet"
]));
await sass.shouldExit(65);
});
}