Skip to content

Commit

Permalink
Merge pull request #2012 from sass/merge-main
Browse files Browse the repository at this point in the history
Merge origin/main into feature.color-4
  • Loading branch information
nex3 authored Sep 12, 2024
2 parents c6b6286 + 563fb47 commit 80b5428
Show file tree
Hide file tree
Showing 20 changed files with 293 additions and 288 deletions.
84 changes: 84 additions & 0 deletions js-api-spec/legacy/render.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,90 @@ describe('options', () => {
});
});

describe('fatalDeprecations', () => {
it('makes specified deprecations fatal', () => {
expect(() =>
sass.renderSync({
data: '$_: 1/2;',
fatalDeprecations: ['slash-div'],
})
).toThrowLegacyException({includes: 'math.div'});
});

it('leaves other deprecations as warnings', () => {
const stdio = captureStdio(() =>
sass.renderSync({
data: '$_: 1/2;',
fatalDeprecations: ['call-string'],
})
);
expect(stdio.out).toBeEmptyString();
expect(stdio.err).toContain('math.div');
});
});

describe('futureDeprecations', () => {
it('opts into future deprecation early', () => {
sandbox(dir => {
dir.write({
'test.scss': '@import "other";',
'_other.scss': '',
});

const stdio = captureStdio(() =>
sass.renderSync({
file: dir('test.scss'),
// data: '@import "other"',
futureDeprecations: ['import'],
})
);
expect(stdio.out).toBeEmptyString();
expect(stdio.err).toContain('@import rule');
});
});

it('emits no warning when not set', () => {
sandbox(dir => {
dir.write({
'test.scss': '@import "other";',
'_other.scss': '',
});

const stdio = captureStdio(() =>
sass.renderSync({
file: dir('test.scss'),
})
);
expect(stdio.out).toBeEmptyString();
expect(stdio.err).toBeEmptyString();
});
});
});

describe('silenceDeprecations', () => {
it('hides specified deprecation warnings', () => {
const stdio = captureStdio(() =>
sass.renderSync({
data: '$_: 1/2;',
silenceDeprecations: ['slash-div'],
})
);
expect(stdio.out).toBeEmptyString();
expect(stdio.err).toBeEmptyString();
});

it('emits other deprecation warnings', () => {
const stdio = captureStdio(() =>
sass.renderSync({
data: '$_: 1/2;',
silenceDeprecations: ['call-string'],
})
);
expect(stdio.out).toBeEmptyString();
expect(stdio.err).toContain('math.div');
});
});

describe('verbose', () => {
const data = `
$_: call("inspect", null);
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions spec/core_functions/global/meta.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ a {
b: true;
}

<===> feature_exists/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
1 | a {b: feature-exists(at-error)}
| ^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> variable_exists/input.scss
Expand Down
109 changes: 109 additions & 0 deletions spec/core_functions/meta/feature_exists.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ a {
b: true;
}

<===> global_variable_shadowing/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(global-variable-shadowing)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> extend_selector_pseudoclass/input.scss
Expand All @@ -24,6 +35,17 @@ a {
b: true;
}

<===> extend_selector_pseudoclass/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(extend-selector-pseudoclass)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> units_level_3/input.scss
Expand All @@ -35,6 +57,17 @@ a {
b: true;
}

<===> units_level_3/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(units-level-3)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> at_error/input.scss
Expand All @@ -46,6 +79,17 @@ a {
b: true;
}

<===> at_error/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(at-error)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> custom_property/input.scss
Expand All @@ -57,6 +101,17 @@ a {
b: true;
}

<===> custom_property/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(custom-property)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> unknown/input.scss
Expand All @@ -68,6 +123,17 @@ a {
b: false;
}

<===> unknown/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(unknown)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> dash_sensitive/input.scss
Expand All @@ -79,6 +145,17 @@ a {
b: false;
}

<===> dash_sensitive/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(at_error)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> quote_insensitive/input.scss
Expand All @@ -90,6 +167,17 @@ a {
b: true;
}

<===> quote_insensitive/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists("at-error")}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> named/input.scss
Expand All @@ -101,13 +189,34 @@ a {
b: true;
}

<===> named/warning
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists($feature: at-error)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/type/input.scss
@use "sass:meta";
a {b: meta.feature-exists(1)}

<===> error/type/error
DEPRECATION WARNING: The feature-exists() function is deprecated.

More info: https://sass-lang.com/d/feature-exists

,
2 | a {b: meta.feature-exists(1)}
| ^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

Error: $feature: 1 is not a string.
,
2 | a {b: meta.feature-exists(1)}
Expand Down
29 changes: 29 additions & 0 deletions spec/directives/at_root.hrx
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
<===> sass/empty/no_query/input.sass
@at-root

<===> sass/empty/no_query/output.css

<===>
================================================================================
<===> sass/empty/query/input.sass
@at-root (with: rule)

<===> sass/empty/query/output.css

<===>
================================================================================
<===> sass/empty/selector/input.sass
@at-root a

<===> sass/empty/selector/output.css

<===> sass/empty/selector/warning
WARNING on line 1, column 10 of input.sass:
This selector doesn't have any properties and won't be rendered.
,
1 | @at-root a
| ^
'

<===>
================================================================================
<===> keyframes/all/input.scss
@keyframes a {
@at-root (without: all) {
Expand Down
Loading

0 comments on commit 80b5428

Please sign in to comment.