Skip to content

Commit

Permalink
use a cwd of "/" for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 5, 2020
1 parent 74983cd commit cdea2cd
Show file tree
Hide file tree
Showing 22 changed files with 1,051 additions and 1,044 deletions.
30 changes: 15 additions & 15 deletions internal/bundler/bundler_css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestCSSAtImportMissing(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputFile: "/out.css",
},
expectedScanLog: `/entry.css: error: Could not resolve "./missing.css"
expectedScanLog: `entry.css: error: Could not resolve "./missing.css"
`,
})
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestCSSFromJSMissingImport(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputDir: "/out",
},
expectedCompileLog: `/entry.js: error: No matching export for import "missing"
expectedCompileLog: `entry.js: error: No matching export for import "missing"
`,
})
}
Expand All @@ -145,7 +145,7 @@ func TestCSSFromJSMissingStarImport(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputDir: "/out",
},
expectedCompileLog: `/entry.js: warning: No matching export for import "missing"
expectedCompileLog: `entry.js: warning: No matching export for import "missing"
`,
})
}
Expand Down Expand Up @@ -195,7 +195,7 @@ func TestImportCSSFromJSWriteToStdout(t *testing.T) {
Mode: config.ModeBundle,
WriteToStdout: true,
},
expectedScanLog: `/entry.js: error: Cannot import "/entry.css" into a JavaScript file without an output path configured
expectedScanLog: `entry.js: error: Cannot import "entry.css" into a JavaScript file without an output path configured
`,
})
}
Expand All @@ -215,7 +215,7 @@ func TestImportJSFromCSS(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputDir: "/out",
},
expectedScanLog: `/entry.css: error: Cannot import "/entry.js" into a CSS file
expectedScanLog: `entry.css: error: Cannot import "entry.js" into a CSS file
`,
})
}
Expand All @@ -235,7 +235,7 @@ func TestImportJSONFromCSS(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputDir: "/out",
},
expectedScanLog: `/entry.css: error: Cannot import "/entry.json" into a CSS file
expectedScanLog: `entry.css: error: Cannot import "entry.json" into a CSS file
`,
})
}
Expand All @@ -253,8 +253,8 @@ func TestMissingImportURLInCSS(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputDir: "/out",
},
expectedScanLog: `/src/entry.css: error: Could not resolve "./one.png"
/src/entry.css: error: Could not resolve "./two.png"
expectedScanLog: `src/entry.css: error: Could not resolve "./one.png"
src/entry.css: error: Could not resolve "./two.png"
`,
})
}
Expand Down Expand Up @@ -314,12 +314,12 @@ func TestInvalidImportURLInCSS(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputDir: "/out",
},
expectedScanLog: `/entry.css: error: Cannot use "/js.js" as a URL
/entry.css: error: Cannot use "/jsx.jsx" as a URL
/entry.css: error: Cannot use "/ts.ts" as a URL
/entry.css: error: Cannot use "/tsx.tsx" as a URL
/entry.css: error: Cannot use "/json.json" as a URL
/entry.css: error: Cannot use "/css.css" as a URL
expectedScanLog: `entry.css: error: Cannot use "js.js" as a URL
entry.css: error: Cannot use "jsx.jsx" as a URL
entry.css: error: Cannot use "ts.ts" as a URL
entry.css: error: Cannot use "tsx.tsx" as a URL
entry.css: error: Cannot use "json.json" as a URL
entry.css: error: Cannot use "css.css" as a URL
`,
})
}
Expand Down Expand Up @@ -517,7 +517,7 @@ func TestCSSAtImportExtensionOrderCollisionUnsupported(t *testing.T) {
".css": config.LoaderCSS,
},
},
expectedScanLog: `/entry.css: error: File could not be loaded: /test.sass
expectedScanLog: `entry.css: error: File could not be loaded: test.sass
`,
})
}
30 changes: 15 additions & 15 deletions internal/bundler/bundler_dce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ func TestPackageJsonSideEffectsFalseKeepBareImportAndRequireES6(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputFile: "/out.js",
},
expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
`in the enclosing "package.json" file
`,
})
Expand Down Expand Up @@ -214,9 +214,9 @@ func TestPackageJsonSideEffectsFalseKeepBareImportAndRequireCommonJS(t *testing.
Mode: config.ModeBundle,
AbsOutputFile: "/out.js",
},
expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
`in the enclosing "package.json" file
`,
})
Expand Down Expand Up @@ -244,9 +244,9 @@ func TestPackageJsonSideEffectsFalseRemoveBareImportES6(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputFile: "/out.js",
},
expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
`in the enclosing "package.json" file
`,
})
Expand Down Expand Up @@ -274,9 +274,9 @@ func TestPackageJsonSideEffectsFalseRemoveBareImportCommonJS(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputFile: "/out.js",
},
expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` +
`Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects
Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` +
`in the enclosing "package.json" file
`,
})
Expand Down Expand Up @@ -722,9 +722,9 @@ func TestPackageJsonSideEffectsArrayGlob(t *testing.T) {
Mode: config.ModeBundle,
AbsOutputFile: "/out.js",
},
expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because ` +
`"/Users/user/project/node_modules/demo-pkg/remove/this/file.js" was marked as having no side effects
/Users/user/project/node_modules/demo-pkg/package.json: note: It was excluded from the "sideEffects" ` +
expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because ` +
`"Users/user/project/node_modules/demo-pkg/remove/this/file.js" was marked as having no side effects
Users/user/project/node_modules/demo-pkg/package.json: note: It was excluded from the "sideEffects" ` +
`array in the enclosing "package.json" file
`,
})
Expand Down
Loading

0 comments on commit cdea2cd

Please sign in to comment.