diff --git a/jest.config.js b/jest.config.js index 947b430..b1b3728 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,7 @@ -module.exports = { +const config = { testEnvironment: 'node', testRegex: '.*\\.test\\.js$|src/.*/__tests__/.*\\.js$', + transform: {}, }; + +export default config; diff --git a/lib/rules/use-typography-styles/index.test.js b/lib/rules/use-typography-styles/index.test.js index 1f0070e..0bd2b30 100644 --- a/lib/rules/use-typography-styles/index.test.js +++ b/lib/rules/use-typography-styles/index.test.js @@ -1,4 +1,4 @@ -import { lint } from 'stylelint'; +import stylelint from 'stylelint'; const config = { plugins: ['./index.js'], @@ -10,7 +10,7 @@ const config = { it('passes when setting non-typography props', async () => { const { results: [{ warnings }], - } = await lint({ + } = await stylelint.lint({ code: 'a { color: $bpk-color-sky-blue; }', config, }); @@ -21,7 +21,7 @@ it('passes when setting non-typography props', async () => { it('passes when using backpack mixins', async () => { const { results: [{ warnings }], - } = await lint({ + } = await stylelint.lint({ code: '@import "~bpk-mixins/index"; a { @include bpk-caption; }', config, }); @@ -32,7 +32,7 @@ it('passes when using backpack mixins', async () => { it('gives an error when setting font size', async () => { const { results: [{ warnings }], - } = await lint({ + } = await stylelint.lint({ code: 'a { font-size: 14rem; }', config, }); @@ -47,7 +47,7 @@ it('gives an error when setting font size', async () => { it('gives an error when using typography tokens', async () => { const { results: [{ warnings }], - } = await lint({ + } = await stylelint.lint({ code: '@import "~bpk-mixins/index"; a { font-weight: $bpk-font-weight-bold; }', config, }); @@ -62,7 +62,7 @@ it('gives an error when using typography tokens', async () => { it('gives an error when using font shorthand', async () => { const { results: [{ warnings }], - } = await lint({ + } = await stylelint.lint({ code: 'a { font: 20px Arial, sans-serif; }', config, }); @@ -78,7 +78,7 @@ it('should error on non-supported options', async () => { const { errored, results: [{ invalidOptionWarnings, warnings }], - } = await lint({ + } = await stylelint.lint({ code: 'a { color: blue; font-size: 14rem }', config: { plugins: ['./index.js'],