Skip to content

Commit

Permalink
Merge pull request #25 from martinRenou/typescript
Browse files Browse the repository at this point in the history
JavaScript -> TypeScript
  • Loading branch information
martinRenou committed Feb 12, 2019
2 parents 0906208 + cf3acdd commit 8874ef9
Show file tree
Hide file tree
Showing 20 changed files with 3,211 additions and 1,774 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules/

# Compiled javascript
ipysheet/static/
js/lib/*

# OS X
.DS_Store
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ before_install:
- conda create -q -n test-environment python=$PYTHON_VERSION ipywidgets runipy
- source activate test-environment
- conda install -c conda-forge pytest pytest-cov nodejs pscript flake8
- if [[ $TRAVIS_OS_NAME == linux ]]; then conda install -c conda-forge jupyterlab; fi
- pip install coveralls
install:
- pip install -e .
- if [[ $TRAVIS_OS_NAME == linux && $PYTHON_VERSION != 2.7 ]]; then jupyter labextension link js; fi
script:
- flake8 ipysheet
- py.test --cov-report= --cov=ipysheet
- (cd js && npm install && ./node_modules/.bin/karma start --single-run)
- (cd js && npm run test)
after_success:
- coveralls
111 changes: 46 additions & 65 deletions js/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,52 @@
// Karma configuration
// Generated on Fri Apr 14 2017 18:21:49 GMT+0200 (CEST)
//var webpackConfig = require('./webpack.config')[1];
// Generated on Wed Jun 20 2018 16:46:14 GMT+0200 (CEST)
var webpackConfig = require('./webpack.config.js');
var webpack = require('webpack');
const process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'karma-typescript'],
files: [
{pattern: 'test/*.ts'},
{pattern: 'src/*.js', included: false, served: false},
],
exclude: ['**/embed.js'],
preprocessors: {
'test/**/*.ts': [ 'karma-typescript']
},
karmaTypescriptConfig: {
bundlerOptions: {
transforms: [
require("karma-typescript-es6-transform")()
]
},
compilerOptions: {
target: "es5",
sourceMap: true
},
coverageOptions: {
exclude: [/\.(d|test)\.ts$/i, /.*node_modules.*/]
},
tsconfig: "./test/tsconfig.json"
},
webpack: {
module: {
rules: [
{ test: /\.json$/, user: 'json-loader' },
{ test: /\.css$/, use: ['style-loader', 'css-loader']},
{ test: /\.tsx?$/, exclude: /node_modules/, use: 'ts-loader'}
]
},
resolve: {
extensions: ['.ts', '.js', ''],
alias: {'handsontable$': '../src/handsontable_fix.js'}
},
devtool: 'inline-source-map',
},
mime: {
"text/x-typescript": ["ts", "tsx"],
},
reporters: ['progress'],
port: 9876,
colors: true,
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
autoWatch: true,
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['HeadlessChrome'],
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// how many browser should be started simultaneous
concurrency: Infinity
})

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
// we use 1 bundle for testing
{ pattern: 'lib/src/test/sheet.js' },
],
exclude: ['**/embed.js'],
preprocessors: {
// the bundle goes through webpack, and will emit (inline) source maps, which karma needs to read again
'lib/src/test/sheet.js': ['webpack', 'sourcemap'],
},
webpack: {
module: {
rules: webpackConfig[2].module.rules
},
// source mapping without inline does not seem to work
devtool: 'inline-source-map',
mode: 'development',
resolve: {
extensions: ['.js']
},
},
reporters: ['progress', 'mocha'],
port: 9876,
colors: true,
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
autoWatch: true,
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['HeadlessChrome'],
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// how many browser should be started simultaneous
concurrency: Infinity
})
}

0 comments on commit 8874ef9

Please sign in to comment.