mirror of
https://github.com/iconify/collections-json.git
synced 2024-11-21 20:15:12 +00:00
test: add cjs tests
This commit is contained in:
parent
56ec61b291
commit
8754f02c92
23
jest.config.cjs.ts
Normal file
23
jest.config.cjs.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import type { Config } from '@jest/types'
|
||||
|
||||
// see https://jestjs.io/docs/ecmascript-modules
|
||||
|
||||
// Sync object
|
||||
const config: Config.InitialOptions = {
|
||||
verbose: true,
|
||||
testMatch: [
|
||||
'**/__tests__/**/*.+(ts|tsx|js)',
|
||||
'**/?(*.)+(spec|test).+(ts|tsx|js)',
|
||||
],
|
||||
moduleDirectories: [
|
||||
'node_modules',
|
||||
'src',
|
||||
],
|
||||
moduleFileExtensions: ['ts', 'js'],
|
||||
extensionsToTreatAsEsm: ['.ts'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
@ -23,7 +23,8 @@
|
||||
"bugs": "https://github.com/iconify/collections-json/issues",
|
||||
"scripts": {
|
||||
"build": "rimraf dist && tsup src/index.ts --format cjs,esm --dts",
|
||||
"test": "yarn build && jest --clearCache && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest"
|
||||
"test-esm": "yarn build && jest --clearCache && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest --config=jest.config.esm.ts",
|
||||
"test-cjs": "yarn build && jest --clearCache && jest --config=jest.config.cjs.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"upath": "^2.0.1"
|
||||
|
@ -6,7 +6,7 @@ const cwd = process.cwd()
|
||||
describe('locate', () => {
|
||||
test('mdi resolves the json collection', () => {
|
||||
const received = locate('mdi') as string
|
||||
const expected = resolve(cwd, 'json/', 'mdi.json').replace(/\\/g, '/')
|
||||
const expected = resolve(cwd, 'json', 'mdi.json').replace(/\\/g, '/')
|
||||
expect(received).toBe(expected)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user