🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
out.js

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down
10 changes: 10 additions & 0 deletions esbuild.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let esbuild = require('esbuild')
esbuild
.build({
entryPoints: ['src/index.test.ts'],
bundle: true,
platform: 'browser',
format: 'iife',
outfile: 'out.js'
})
.catch(() => process.exit(1))
19 changes: 19 additions & 0 deletions karma.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = function (config) {
config.set({
plugins: ['karma-webpack', 'karma-jasmine', 'karma-chrome-launcher'],

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],

// list of files / patterns to load in the browser
// Here I'm including all of the the Jest tests which are all under the __tests__ directory.
// You may need to tweak this pattern to find your test files/
files: ['./karma-setup.js', 'out.js'],
browsers: ['ChromeHeadless'],
singleRun: true
})
}
14 changes: 14 additions & 0 deletions karma.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// the jest.fn() API
let jest = require('jest-mock')
// The matchers API
let expect = require('expect')

// Add missing Jest functions
window.test = window.it
window.test.each = (inputs) => (testName, test) =>
inputs.forEach((args) => window.it(testName, () => test(...args)))
window.test.todo = function () {
return undefined
}
window.jest = jest
window.expect = expect
Loading