Skip to content

Commit

Permalink
Jest -> Vitest for ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewLeedham committed Aug 7, 2023
1 parent 2227747 commit 192f90a
Show file tree
Hide file tree
Showing 14 changed files with 647 additions and 1,674 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run audit
- run: pnpm run lint
- run: pnpm run test

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run audit
- run: pnpm run lint
- run: pnpm run test
13 changes: 0 additions & 13 deletions __tests__/audit.test.js

This file was deleted.

18 changes: 0 additions & 18 deletions jest-esm-resolver.js

This file was deleted.

3 changes: 0 additions & 3 deletions jest.config.js

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"lint": "eslint ./packages/**/*.js && prettier ./**/*.json --check --ignore-path .gitignore && pnpm --filter './packages/*' run lint",
"format": "eslint ./packages/**/*.js --format && prettier ./**/*.json --write --ignore-path .gitignore",
"deploy": "auto shipit",
"test": "jest"
"test": "vitest",
"audit": "pnpm audit --prod --audit-level moderate"
},
"eslintConfig": {
"parserOptions": {
Expand All @@ -34,11 +35,10 @@
"browserslist": "4.21.10",
"enhanced-resolve": "5.15.0",
"eslint": "8.46.0",
"jest": "29.6.2",
"jest-package-audit": "5.0.3",
"lerna": "7.1.4",
"prettier": "3.0.1",
"stylelint": "15.10.2"
"stylelint": "15.10.2",
"vitest": "0.34.1"
},
"packageManager": "pnpm@8.6.12",
"pnpm": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { ESLint } = require('eslint');
const { posix } = require('path');
import { test, expect } from 'vitest';
import { ESLint } from 'eslint';
import { posix } from 'path';

test.each(['index.js', 'react.js', 'typescript.js', 'jest.js'])(
'%s config valid',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const glob = require('globby');
const { posix } = require('path');
const { ESLint } = require('eslint');
import { test, expect } from 'vitest';
import glob from 'globby';
import { ESLint } from 'eslint';

const fixtures = glob.sync(
posix.join(__dirname, '../../../fixtures/*/index.*')
new URL('../../../fixtures/*/index.*', import.meta.url).pathname
);

const cli = new ESLint();
Expand Down
14 changes: 0 additions & 14 deletions packages/xerox-stylelint-config/__tests__/configs.test.js

This file was deleted.

14 changes: 14 additions & 0 deletions packages/xerox-stylelint-config/__tests__/configs.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { test, expect } from 'vitest';
import styelint from 'stylelint';

test.each(['index.cjs', 'sass.cjs'])('%s config valid', async (filename) => {
await expect(
styelint.lint({
code: 'a {}',
config: {
extends: `./${filename}`,
},
configBasedir: new URL('../', import.meta.url).pathname,
})
).resolves.toBeTruthy();
});
File renamed without changes.
8 changes: 4 additions & 4 deletions packages/xerox-stylelint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"stylelint-config",
"xerox"
],
"main": "index.json",
"main": "index.cjs",
"repository": "git@github.com:xeroxinteractive/config.git",
"homepage": "https://github.com/xeroxinteractive/config/blob/master/packages/xerox-stylelint-config",
"author": "Andrew Leedham <andrew.leedham@xerox.com>",
Expand All @@ -19,10 +19,10 @@
"stylelint": "*"
},
"dependencies": {
"stylelint-config-prettier": "^9.0.0",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-recommended": "^13.0.0",
"stylelint-prettier": "^3.0.0",
"stylelint-scss": "^5.0.0"
"stylelint-prettier": "^4.0.2",
"stylelint-scss": "^5.0.1"
},
"devDependencies": {
"@xerox/prettier-config": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: './index.js',
extends: './index.cjs',
plugins: ['stylelint-scss'],
rules: {
'at-rule-no-unknown': null,
Expand Down
Loading

0 comments on commit 192f90a

Please sign in to comment.