Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6e5d2df
Add Mocha, Chai, and Karma
eKoopmans Apr 18, 2019
1cae362
Add initial Karma config and test script
eKoopmans Apr 19, 2019
c93fcde
Add basic Promise test
eKoopmans Apr 19, 2019
7327127
Add karma-rollup-preprocessor and update rollup
eKoopmans Apr 19, 2019
a3a2419
Run tests directly on src using rollup
eKoopmans Apr 19, 2019
bd451b5
Add basic html2pdf tests
eKoopmans Apr 20, 2019
1bb1d13
Update mocha for security
eKoopmans Jun 29, 2019
14e6a1b
Add tests for settings
eKoopmans Jul 1, 2019
f9d5eb5
Add closures and return statements to fix tests
eKoopmans Jul 2, 2019
abd244b
Update testing values of src and pageSize
eKoopmans Jul 2, 2019
ea3804b
Remove pageSize from general test
eKoopmans Jul 2, 2019
bdb7434
Remove old settings tests
eKoopmans Jul 2, 2019
fe446d7
Reorder settings check to capture pageSize
eKoopmans Jul 2, 2019
a933772
Fix test of individual settings
eKoopmans Jul 3, 2019
92323bd
Move settings tests into a separate file
eKoopmans Jul 3, 2019
149df78
Add margin tests
eKoopmans Jul 5, 2019
fe5e528
Add pageSize test
eKoopmans Jul 5, 2019
1533f0d
Add more tests for pageSize
eKoopmans Jul 5, 2019
bd7e4ca
Add PDF testing framework from jsPDF
eKoopmans Jul 7, 2019
0757034
Fix reference-server PDF creation
eKoopmans Jul 7, 2019
4173d00
Fix reference-server when writing to a new folder
eKoopmans Jul 9, 2019
124c991
Watch reference files for changes
eKoopmans Jul 9, 2019
53dd2ba
Suppress console.log during tests
eKoopmans Jul 9, 2019
1284f7a
Remove top-level Mocha descriptor
eKoopmans Jul 9, 2019
c6f5443
Update test wording
eKoopmans Jul 9, 2019
012edf2
Fix/add existence checks
eKoopmans Jul 9, 2019
fbbf580
Add legacy mode tests
eKoopmans Jul 9, 2019
5d3b23c
Add chai-spies for testing
eKoopmans Jul 9, 2019
2bfbdf7
Convert stubbed save method into a chai-spy
eKoopmans Jul 9, 2019
d47ac00
Re-enable console logging during tests
eKoopmans Feb 27, 2021
43b5db3
Add pdftest and start-server-and-test dependencies
eKoopmans Feb 27, 2021
2422483
Add pdftest to the testing scripts
eKoopmans Feb 27, 2021
9860b6e
Use browser-resolve to load pdftest in karma
eKoopmans Feb 27, 2021
44d0ba7
Use pdftest in legacy test
eKoopmans Feb 27, 2021
6908978
Remove test timeouts for PDF snapshot GUI
eKoopmans Apr 6, 2021
9a8434e
Switch to toMatchPdfSnapshot
eKoopmans Apr 6, 2021
1831051
Update margin-1in ref PDF
eKoopmans Apr 6, 2021
7f46dc6
Switch to new matchPdfSnapshot signature
eKoopmans Apr 7, 2021
dc6441c
Remove watcher on chai-pdftest
eKoopmans Apr 10, 2021
d739ce2
Add rollup preprocessor to tests
eKoopmans Apr 25, 2021
8cf56b1
Enable interactive mode
eKoopmans Apr 25, 2021
ac9bdb2
Switch to pdftest 0.2.0
eKoopmans Apr 25, 2021
6077b8a
Merge branch 'master' into feature/testing-pdftest
eKoopmans Apr 25, 2021
4effa22
Update karma pdftest imports
eKoopmans Apr 25, 2021
31eebbc
Remove old reference-server code
eKoopmans Apr 25, 2021
76a5d04
Remove local linking of pdftest
eKoopmans Apr 25, 2021
10718d8
Fix karma imports and legacy test code
eKoopmans Apr 25, 2021
8cbeb7c
Add snapshot
eKoopmans Apr 25, 2021
9fb1036
Restructure snapshot tests
eKoopmans Jun 15, 2021
181f280
Add baseline CSS to remove body margins
eKoopmans Jun 15, 2021
4ab3efb
Add all-tags test case
eKoopmans Jun 17, 2021
92eeb79
Add manual test launcher
eKoopmans Jun 18, 2021
b0eadbc
Add css-selectors test
eKoopmans Jun 18, 2021
92b902c
Clean up tests of settings
eKoopmans Jun 18, 2021
54eb7dc
Refactor snapshot test conditions
eKoopmans Jun 18, 2021
21667c6
Add pagebreak snapshot tests
eKoopmans Jun 18, 2021
98f29ce
Refactor condition runners and names
eKoopmans Jun 18, 2021
6ef0c76
Upgrade pdftest to fix file-size issue
eKoopmans Jul 9, 2021
2bbe9d4
Revert "Reorder settings check to capture pageSize"
eKoopmans Jul 9, 2021
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
129 changes: 129 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Karma configuration

// Load Rollup dependencies
const rollupConfig = {
resolve: require('rollup-plugin-node-resolve'),
commonjs: require('rollup-plugin-commonjs'),
replace: require('rollup-plugin-replace'),
babel: require('rollup-plugin-babel')
}

module.exports = function(config) {
config.set({

// 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: ['mocha', 'chai-spies', 'chai'],


// list of files / patterns to load in the browser
files: [
{ pattern: 'src/index.js', watched: false },
{ pattern: 'test/reference/*.*', included: false, served: true },
{ pattern: require.resolve('pdftest/dist/pdftest.client.min.js'), watched: false },
{ pattern: require.resolve('pdftest/dist/chai-pdftest.min.js'), watched: false },
'test/**/*.js'
],


// list of files / patterns to exclude
exclude: [
'test/manual/',
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/index.js': ['rollup'],
'test/**/*.js': ['rollupTests'],
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,


// Remove timeouts so the PDF snapshot GUI can wait on user feedback.
browserNoActivityTimeout: 0,


// Suppress console.log messages
client: {
// captureConsole: false
},


// Rollup preprocessor
// Setup as a normal Rollup config object, just without the input
// It has its own autoWatch behaviour, so Karma's file watcher must be disabled on its files
rollupPreprocessor: {
output: {
name: 'html2pdf',
format: 'iife',
globals: {
jspdf: 'jsPDF',
html2canvas: 'html2canvas'
}
},
plugins: [
rollupConfig.resolve(),
rollupConfig.commonjs(),
rollupConfig.replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
rollupConfig.babel({ exclude: 'node_modules/**' })
]
},

customPreprocessors: {
rollupTests: {
base: 'rollup',
options: {
output: {
name: 'html2pdf_test',
format: 'iife',
globals: {
html2pdf: 'html2pdf',
},
},
},
},
},
})
}
Loading