-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Karma / Mocha with Jest (#415)
* Remove mocha / karma setup * Replace innerText with textContent to make jest working innerText is not standard and therfore not supported by jsdom. Also according to this article https://kellegous.com/j/2013/02/27/innertext-vs-textcontent/ innerText is much slower than textContent. * Drop dynamic require * Setup jest * Reimplement fixture loading * Minimal required changes to make jest working * upgrade nodejs version * Make loadPlugins an object instead of a function See https://github.com/OctoLinker/browser-extension/pull/415/files#diff-63ac5d48d83927921b7bcdb2b5a8d124R50 * fixup! Minimal required changes to make jest working * Using path.posix.join to fix Windows issues
- Loading branch information
1 parent
ec40563
commit e50f339
Showing
24 changed files
with
1,376 additions
and
998 deletions.
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
// Load all plugins from /lib/plugins/*/index.js. | ||
// For more information about dynamic require see | ||
// https://webpack.github.io/docs/context.html | ||
|
||
export default function loadPlugins() { | ||
function requireAll(requireContext) { | ||
return requireContext | ||
.keys() | ||
.map(pluginPath => requireContext(pluginPath).default); | ||
} | ||
|
||
return requireAll(require.context('./plugins', false, /[^/]*.js$/)); | ||
} | ||
export { default as BowerManifest } from './plugins/bower-manifest.js'; | ||
export { default as Composer } from './plugins/composer-manifest.js'; | ||
export { default as CSS } from './plugins/css.js'; | ||
export { default as Docker } from './plugins/docker.js'; | ||
export { default as DotNetCore } from './plugins/dot-net-core.js'; | ||
export { default as DotNet } from './plugins/dot-net.js'; | ||
export { default as Rubygems } from './plugins/gemfile-manifest.js'; | ||
export { default as Go } from './plugins/go.js'; | ||
export { default as Haskell } from './plugins/haskell.js'; | ||
export { default as Homebrew } from './plugins/homebrew-manifest.js'; | ||
export { default as HTML } from './plugins/html.js'; | ||
export { default as Java } from './plugins/java.js'; | ||
export { default as JavaScript } from './plugins/javascript.js'; | ||
export { default as Less } from './plugins/less.js'; | ||
export { | ||
default as NodejsRelativePath, | ||
} from './plugins/nodejs-relative-path.js'; | ||
export { default as NpmManifest } from './plugins/npm-manifest.js'; | ||
export { default as Python } from './plugins/python.js'; | ||
export { default as RequirementsTxt } from './plugins/requirements-txt.js'; | ||
export { default as Ruby } from './plugins/ruby.js'; | ||
export { default as Rust } from './plugins/rust.js'; | ||
export { default as Sass } from './plugins/sass.js'; | ||
export { default as TypeScript } from './plugins/typescript.js'; | ||
export { default as Vim } from './plugins/vim.js'; |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { join, dirname } from 'path'; | ||
import { posix, dirname } from 'path'; | ||
|
||
export default function({ path, target }) { | ||
return `{BASE_URL}${join(dirname(path), target)}`; | ||
return `{BASE_URL}${posix.join(dirname(path), target)}`; | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
global.chrome = {}; | ||
global.chrome.runtime = { | ||
sendMessage: jest.fn(), | ||
}; | ||
|
||
global.fixture = { | ||
load: file => { | ||
const fullPath = path.join(__dirname, '..', file); | ||
const fixture = fs.readFileSync(fullPath); | ||
document.body.innerHTML = fixture.toString(); | ||
}, | ||
cleanup: () => { | ||
document.body.innerHTML = ''; | ||
}, | ||
}; |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.