From 6a1a8dd61ac90a1a145be633549717745cb701a8 Mon Sep 17 00:00:00 2001 From: pelusanchez Date: Mon, 11 Oct 2021 14:32:47 +0200 Subject: [PATCH] Fixed jest for shaders loaders upgrade. --- dist/shaders/index.d.ts | 4 ++-- jest.config.ts | 7 +++++++ package.json | 6 ++++-- src/shaders/index.ts | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 jest.config.ts diff --git a/dist/shaders/index.d.ts b/dist/shaders/index.d.ts index 6c83aa8..fa9a51a 100644 --- a/dist/shaders/index.d.ts +++ b/dist/shaders/index.d.ts @@ -1,3 +1,3 @@ -import FRAGMENT_SHADER from './fragment_shader.frag'; -import VERTEX_SHADER from './vertex_shader.vert'; +import FRAGMENT_SHADER from '!!raw-loader!./fragment_shader.frag'; +import VERTEX_SHADER from '!!raw-loader!./vertex_shader.vert'; export { FRAGMENT_SHADER, VERTEX_SHADER }; diff --git a/jest.config.ts b/jest.config.ts new file mode 100644 index 0000000..3737f34 --- /dev/null +++ b/jest.config.ts @@ -0,0 +1,7 @@ +const config = { + moduleNameMapper: { + "^!!raw-loader!.*": "jest-raw-loader", + } +} + +export default config; diff --git a/package.json b/package.json index c70326f..54eb461 100644 --- a/package.json +++ b/package.json @@ -36,11 +36,13 @@ "@babel/preset-env": "^7.13.9", "@babel/preset-typescript": "^7.13.0", "@types/jest": "^26.0.20", - "babel-jest": "^26.6.3", - "jest": "^26.6.3", + "babel-jest": "^27.2.5", + "jest": "^27.2.5", + "jest-raw-loader": "^1.0.1", "raw-loader": "^4.0.2", "source-map": "^0.7.3", "ts-loader": "^8.0.17", + "ts-node": "^10.2.1", "typescript": "^4.2.2", "webpack": "^5.24.3", "webpack-cli": "^4.5.0", diff --git a/src/shaders/index.ts b/src/shaders/index.ts index 4b05dd0..a779392 100644 --- a/src/shaders/index.ts +++ b/src/shaders/index.ts @@ -1,3 +1,3 @@ -import FRAGMENT_SHADER from './fragment_shader.frag'; -import VERTEX_SHADER from './vertex_shader.vert'; +import FRAGMENT_SHADER from '!!raw-loader!./fragment_shader.frag'; +import VERTEX_SHADER from '!!raw-loader!./vertex_shader.vert'; export { FRAGMENT_SHADER, VERTEX_SHADER }