Skip to content

Commit

Permalink
[Package Importer] Specs (#1952)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonny Gerig Meyer <jonny@oddbird.net>
  • Loading branch information
jamesnw and jgerigmeyer authored Feb 6, 2024
1 parent f013971 commit 831297e
Show file tree
Hide file tree
Showing 4 changed files with 943 additions and 9 deletions.
9 changes: 8 additions & 1 deletion js-api-spec/importer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import {
compileStringAsync,
CanonicalizeContext,
Importer,
NodePackageImporter,
} from 'sass';

import {sassImpl, URL} from './utils';
import {sassImpl, runOnlyForImpl, URL} from './utils';

it('uses an importer to resolve an @import', () => {
const result = compileString('@import "orange";', {
Expand Down Expand Up @@ -763,6 +764,12 @@ it('throws an ArgumentError when the result sourceMapUrl is missing a scheme', (
});
});

runOnlyForImpl('browser', () => {
it('node package loader throws error in browser', () => {
expect(() => new NodePackageImporter()).toThrow();
});
});

/**
* Returns an importer that asserts that `fromImport` is `expected`, and
* otherwise imports exclusively empty stylesheets.
Expand Down
Loading

0 comments on commit 831297e

Please sign in to comment.