1- import { requireFresh } from "requirefresh"
21import assert from "assert"
3- import * as path from "path"
4-
5- type Terserrc = typeof import ( "../src/.terserrc" )
6- function requireTerserrc ( ) : Terserrc {
7- return requireFresh ( path . join ( path . dirname ( __dirname ) , "src" , ".terserrc.js" ) )
8- }
2+ import { getTerserrc } from "../src/get-terserrc.js"
93
104describe ( "Terser-Config-Atomic" , ( ) => {
115 it ( "production" , ( ) => {
12- process . env . NODE_ENV = "production"
13-
14- const TerserOptions = requireTerserrc ( )
6+ const TerserOptions = getTerserrc ( "production" , undefined )
157
168 expect ( typeof TerserOptions ) . toBe ( "object" )
179 assert ( typeof TerserOptions . compress === "object" )
@@ -28,7 +20,7 @@ describe("Terser-Config-Atomic", () => {
2820 it ( "development" , ( ) => {
2921 process . env . NODE_ENV = "development"
3022
31- const TerserOptions = requireTerserrc ( )
23+ const TerserOptions = getTerserrc ( "development" , undefined )
3224
3325 expect ( typeof TerserOptions ) . toBe ( "object" )
3426 expect ( TerserOptions . compress ) . toBe ( false )
@@ -38,7 +30,7 @@ describe("Terser-Config-Atomic", () => {
3830 it ( "test" , ( ) => {
3931 process . env . NODE_ENV = "test"
4032
41- const TerserOptions = requireTerserrc ( )
33+ const TerserOptions = getTerserrc ( "test" , undefined )
4234
4335 expect ( typeof TerserOptions ) . toBe ( "object" )
4436 assert ( typeof TerserOptions . compress === "object" )
0 commit comments