Skip to content

Commit 0647e2c

Browse files
Merge pull request #1300 from nhsuk/sass-warning-paths
Fix deprecation warnings for settings and tools `/all` paths
2 parents 49bf89b + 67355f6 commit 0647e2c

File tree

6 files changed

+66
-5
lines changed

6 files changed

+66
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# NHS.UK frontend Changelog
22

3+
## 9.5.1 - 14 May 2025
4+
5+
:wrench: **Fixes**
6+
7+
We've made fixes to NHS.UK frontend in the following pull requests:
8+
9+
- [#1300: Fix deprecation warnings for settings and tools `/all` paths](https://github.com/nhsuk/nhsuk-frontend/pull/1300)
10+
311
## 9.5.0 - 13 May 2025
412

513
:new: **New features**

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nhsuk-frontend",
3-
"version": "9.5.0",
3+
"version": "9.5.1",
44
"description": "NHS.UK frontend contains the code you need to start building user interfaces for NHS websites and services.",
55
"engines": {
66
"node": "^20.9.0 || ^22.11.0"

packages/core/core.unit.test.mjs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { compileStringAsync, sassNull } from 'sass-embedded'
2+
3+
describe('Core', () => {
4+
/** @type {Logger} */
5+
let logger = {}
6+
7+
beforeEach(() => {
8+
// Create a mock warn function that we can use to override the native @warn
9+
// function, that we can make assertions about post-render.
10+
logger.warn = jest.fn().mockReturnValue(sassNull)
11+
})
12+
13+
describe('importing using "all" files', () => {
14+
it('outputs a warning when importing the core "all" file', async () => {
15+
const sass = `
16+
@forward "core/all";
17+
`
18+
19+
await compileStringAsync(sass, {
20+
loadPaths: ['packages'],
21+
logger
22+
})
23+
24+
expect(logger.warn).toHaveBeenCalledWith(
25+
`Importing using 'core/all' is deprecated. Update your import statement to import 'core'. To silence this warning, update $nhsuk-suppressed-warnings with key: "import-using-all"`,
26+
expect.anything()
27+
)
28+
})
29+
30+
it('outputs a warning for each layer that has an "all" file', async () => {
31+
const sass = `
32+
@forward "core/settings/all";
33+
@forward "core/tools/all";
34+
`
35+
36+
await compileStringAsync(sass, {
37+
loadPaths: ['packages'],
38+
logger
39+
})
40+
41+
for (const layer of ['settings', 'tools']) {
42+
expect(logger.warn).toHaveBeenCalledWith(
43+
`Importing using 'core/${layer}/all' is deprecated. Update your import statement to import 'core/${layer}'. To silence this warning, update $nhsuk-suppressed-warnings with key: "import-using-all"`,
44+
expect.anything()
45+
)
46+
}
47+
})
48+
})
49+
})
50+
51+
/**
52+
* @import { Logger } from 'sass-embedded'
53+
*/

packages/core/settings/_all.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use "settings/warnings" as *;
1+
@use "warnings" as *;
22
@forward ".";
33

44
@include nhsuk-warning(

packages/core/tools/_all.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use "settings/warnings" as *;
1+
@use "../settings/warnings" as *;
22
@forward ".";
33

44
@include nhsuk-warning(

0 commit comments

Comments
 (0)