Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anambl committed Jun 14, 2024
1 parent 911812d commit a9f12b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
const config = {
testEnvironment: 'node',
testRegex: '.*\\.test\\.js$|src/.*/__tests__/.*\\.js$',
transform: {},
};

export default config;
14 changes: 7 additions & 7 deletions lib/rules/use-typography-styles/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lint } from 'stylelint';
import stylelint from 'stylelint';

const config = {
plugins: ['./index.js'],
Expand All @@ -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,
});
Expand All @@ -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,
});
Expand All @@ -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,
});
Expand All @@ -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,
});
Expand All @@ -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,
});
Expand All @@ -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'],
Expand Down

0 comments on commit a9f12b4

Please sign in to comment.