From befccc5c59e05d7a56c927818c465855c899c5dd Mon Sep 17 00:00:00 2001 From: Daniel Bayley Date: Thu, 15 Oct 2020 20:13:08 +0100 Subject: [PATCH] Avoid overriding package.json Resolves #45. --- jest-preset.coffee | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/jest-preset.coffee b/jest-preset.coffee index cd2c876..f60a2fc 100644 --- a/jest-preset.coffee +++ b/jest-preset.coffee @@ -1,17 +1,8 @@ import fs from 'fs' import path from 'path' import {compile, helpers as h, FILE_EXTENSIONS} from 'coffeescript' -import package_json, {jest} from './package'#.json -{name} = path.parse __filename coffee = FILE_EXTENSIONS.map (ext) => ext[1..] -glob = "*.@(#{coffee.join '|'})" - -package_json.main = jest.preset = "./#{name}" -[staged] = Object.values package_json['lint-staged'] -package_json['lint-staged'] = [glob]: staged -delete jest.rootDir -fs.writeFileSync 'package.json', JSON.stringify package_json, null, 2 if describe? override = describe @@ -20,7 +11,7 @@ if describe? module.exports = moduleFileExtensions: ['js', 'json', coffee...] - testMatch: ["/*@(test|spec)?(s){/**/,}#{glob}"] + testMatch: ["/*@(test|spec)?(s){/**/,}@(#{coffee.join '|'})"] testPathIgnorePatterns: ['node_modules', 'fixtures'] transform: [coffee.join '|']: __filename setupFilesAfterEnv: [__filename ]