Last active
July 27, 2022 16:39
-
-
Save edojacobs/9cfdcb016b77954daa2cbae5eaa34f24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @jest-environment jsdom | |
*/ | |
import { Component } from '../dist/component'; | |
it('test babylonjs', ()=> { | |
expect(new Component()).not.toBeUndefined() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
clearMocks: true, | |
moduleFileExtensions: ['js', 'ts'], | |
roots: ['./test'], | |
testEnvironment: 'node', | |
preset: 'ts-jest', | |
transform: { | |
'.(ts|js)': 'ts-jest', | |
'\\.[jt]sx?$': 'babel-jest', | |
}, | |
moduleNameMapper: { | |
'/^Util/(.*)$/': './util', | |
'/^lib/(.*)$/': './lib', | |
}, | |
moduleDirectories: ['./src', './node_modules'], | |
transformIgnorePatterns: ['./node_modules'], | |
globals: { | |
'ts-jest': { | |
isolatedModules: true, | |
tsConfig: 'tsconfig.dev.json', | |
}, | |
}, | |
}; | |
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"test": "jest --verbose", | |
"rollup": "rollup -c", | |
"build": "npm run rollup" | |
}, | |
"dependencies": { | |
"@babylonjs/core": "^5.16.0", | |
"@babylonjs/loaders": "^5.16.0", | |
}, | |
"devDependencies": { | |
"@rollup/plugin-commonjs": "^22.0.1", | |
"@rollup/plugin-node-resolve": "^13.3.0", | |
"@rollup/plugin-url": "^7.0.0", | |
"@types/jest": "^28.1.6", | |
"@types/node": "^18.0.4", | |
"babel-jest": "^28.1.3", | |
"jest": "^28.1.3", | |
"rollup": "^2.77.0", | |
"rollup-plugin-multi-input": "^1.3.1", | |
"rollup-plugin-node-externals": "^4.1.1", | |
"rollup-plugin-terser": "^7.0.2", | |
"rollup-plugin-typescript2": "^0.32.1", | |
"jest-environment-jsdom": "^28.1.3", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import url from '@rollup/plugin-url'; | |
import { terser } from 'rollup-plugin-terser'; | |
import commonjs from '@rollup/plugin-commonjs'; | |
import resolve from '@rollup/plugin-node-resolve'; | |
import typescript from 'rollup-plugin-typescript2'; | |
import multiInput from 'rollup-plugin-multi-input'; | |
export default [ | |
{ | |
input: ['./src/**/*.ts'], | |
external: [], | |
output: [ | |
{ | |
dir: 'dist', | |
format: 'cjs', | |
sourcemap: true, | |
name: 'react-lib', | |
}, | |
{ | |
dir: 'dist', | |
format: 'esm', | |
sourcemap: true, | |
}, | |
], | |
plugins: [ | |
multiInput({ relative: 'src/' }), | |
typescript({ | |
tsconfig: './tsconfig.dev.json', | |
}), | |
commonjs({ | |
include: ['node_modules/**'], | |
}), | |
resolve({ | |
extensions: ['.js', '.json', '.jsx', '.ts'], | |
}), | |
url(), | |
terser(), | |
], | |
}, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"outDir": "dist", | |
"rootDir": ".", | |
"strict": true, | |
"esModuleInterop": true, | |
"declaration": true, | |
"allowJs": true, | |
"target": "ES2015", | |
"module": "ESNext", | |
"moduleResolution": "node", | |
"noResolve": false, | |
"noImplicitAny": false, | |
"sourceMap": true, | |
"preserveConstEnums": true, | |
"lib": ["dom", "es6"] | |
}, | |
"include": ["src", "test", "jest.config.ts", "rollup.config.ts"], | |
"exclude": ["node_modules"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"outDir": "build", | |
"rootDir": "src", | |
"strict": true, | |
"esModuleInterop": true, | |
"declaration": true, | |
"allowJs": true, | |
"target": "es6", | |
"module": "CommonJS", | |
"moduleResolution": "node", | |
"noResolve": false, | |
"noImplicitAny": false, | |
"preserveConstEnums": true, | |
"lib": ["dom", "es6"] | |
}, | |
"include": ["src/**/*"], | |
"exclude": ["node_modules"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment