binhend 1.5.12 → 1.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
function binhendPreprocessor(config) {
|
|
3
|
+
const { rootPath } = config.binhend;
|
|
4
|
+
return (content, file, done) => {
|
|
5
|
+
var path = file.path.replace(rootPath, '');
|
|
6
|
+
content = content.replace(/(\.ui\(|\.service\(|\.style\()/, `$1'${path}', `)
|
|
7
|
+
done(null, content);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
'preprocessor:binhend': ['factory', binhendPreprocessor]
|
|
13
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module.exports = function(config) {
|
|
2
|
+
|
|
3
|
+
const SCRIPT_INCLUDED_PATTERN = 'build/web/**/*.js';
|
|
4
|
+
const TEST_INCLUDED_PATTERN = '../src/**/*.test.js';
|
|
5
|
+
const TEST_EXCLUDED_PATTERN = 'build/web/**/*.test.js';
|
|
6
|
+
|
|
7
|
+
config.set({
|
|
8
|
+
frameworks: ['mocha', 'chai'], // Use Mocha and Chai for testing
|
|
9
|
+
browsers: ['ChromeHeadless'], // Use Google Chrome Headless
|
|
10
|
+
reporters: ['mocha', 'coverage'], // Generate test report and coverage report
|
|
11
|
+
|
|
12
|
+
files: [
|
|
13
|
+
'https://binhjs.pages.dev/dist/binh.min.js',
|
|
14
|
+
SCRIPT_INCLUDED_PATTERN,
|
|
15
|
+
TEST_INCLUDED_PATTERN
|
|
16
|
+
],
|
|
17
|
+
exclude: [
|
|
18
|
+
TEST_EXCLUDED_PATTERN
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
preprocessors: {
|
|
22
|
+
[SCRIPT_INCLUDED_PATTERN]: ['binhend', 'coverage'] // Instrument source files for code coverage
|
|
23
|
+
},
|
|
24
|
+
plugins: [
|
|
25
|
+
require('karma-chai'),
|
|
26
|
+
require('karma-mocha'),
|
|
27
|
+
require('karma-coverage'),
|
|
28
|
+
require('karma-mocha-reporter'),
|
|
29
|
+
require('karma-chrome-launcher'),
|
|
30
|
+
require('./binhend-preprocessor')
|
|
31
|
+
],
|
|
32
|
+
binhend: {
|
|
33
|
+
rootPath: require('path').resolve(__dirname, 'web').replace(/\\/g, '/')
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
mochaReporter: { // Configure Mocha reporter options
|
|
37
|
+
output: 'autowatch', // Output test results during the watch mode
|
|
38
|
+
showDiff: true // Show the differences in assertion failures
|
|
39
|
+
},
|
|
40
|
+
coverageReporter: {
|
|
41
|
+
dir: 'coverage', // Output directory for coverage reports
|
|
42
|
+
reporters: [
|
|
43
|
+
{ type: 'html', subdir: 'html' }, // Generate HTML coverage report
|
|
44
|
+
{ type: 'lcovonly', subdir: '.', file: 'lcov.info' }, // Generate lcov.info file
|
|
45
|
+
{ type: 'text-summary' } // Generate text summary report
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
singleRun: true // Set to false to keep Karma running after tests complete
|
|
49
|
+
});
|
|
50
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "testing",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"chai": "^4.3.7",
|
|
10
|
+
"karma": "^6.4.3",
|
|
11
|
+
"karma-chai": "^0.1.0",
|
|
12
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
13
|
+
"karma-coverage": "^2.2.1",
|
|
14
|
+
"karma-mocha": "^2.0.1",
|
|
15
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
16
|
+
"mocha": "^10.4.0"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=16.17.1",
|
|
20
|
+
"npm": ">=8.15.0"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "npm i & node index.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { Binh } = require('binhend');
|
|
2
|
+
const karma = require('karma');
|
|
3
|
+
|
|
4
|
+
var app = new Binh();
|
|
5
|
+
|
|
6
|
+
app.remove('build');
|
|
7
|
+
|
|
8
|
+
app.webLazy({
|
|
9
|
+
source: '../src',
|
|
10
|
+
module: 'build/module',
|
|
11
|
+
web: 'build/web'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
const karmaConfig = karma.config.parseConfig(__dirname + '/karma.conf.js');
|
|
16
|
+
|
|
17
|
+
const server = new karma.Server(karmaConfig, function (exitCode) {
|
|
18
|
+
process.exit(exitCode);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
server.start();
|
|
22
|
+
}, 3000);
|
|
23
|
+
|
|
24
|
+
module.exports = app;
|