add popper.js
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# Popper.js scripts
|
||||
|
||||
This package is a list of scripts used by Popper.js and Tooltip.js to
|
||||
test the packages.
|
||||
|
||||
It's not intended to be used outside of Popper.js repository.
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
const path = require('path');
|
||||
const { Server, config } = require('karma');
|
||||
|
||||
const karmaConfig = config.parseConfig(
|
||||
path.resolve(__dirname, '../karma.conf.js')
|
||||
);
|
||||
|
||||
const server = new Server(karmaConfig, exitCode => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
server.start();
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
const { argv } = require('yargs');
|
||||
const path = require('path');
|
||||
const babel = require('rollup-plugin-babel');
|
||||
const resolve = require('rollup-plugin-node-resolve');
|
||||
|
||||
const browsers = (argv.browsers || process.env.BROWSERS || 'ChromeHeadless').split(',');
|
||||
const singleRun = process.env.NODE_ENV === 'development' ? false : true;
|
||||
const coverage = process.env.COVERAGE === true;
|
||||
const basePath = process.cwd();
|
||||
|
||||
const babelrc = {
|
||||
babelrc: false,
|
||||
presets: [
|
||||
[require.resolve('babel-preset-es2015'), { modules: false }],
|
||||
require.resolve('babel-preset-stage-2'),
|
||||
],
|
||||
plugins: [
|
||||
require.resolve('babel-plugin-external-helpers'),
|
||||
[
|
||||
require.resolve('babel-plugin-module-resolver'),
|
||||
{
|
||||
alias: {
|
||||
src: './src',
|
||||
'popper.js': '../popper/src/index.js',
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
if (coverage) {
|
||||
babelrc.plugins.unshift(require.resolve('babel-plugin-istanbul'));
|
||||
}
|
||||
|
||||
module.exports = function(config) {
|
||||
const configuration = {
|
||||
basePath,
|
||||
frameworks: ['jasmine', 'chai', 'sinon'],
|
||||
singleRun,
|
||||
browserNoActivityTimeout: 60000,
|
||||
browserDisconnectTolerance: 10,
|
||||
browsers: browsers,
|
||||
autoWatch: true,
|
||||
concurrency: 2,
|
||||
browserConsoleLogOptions: {
|
||||
level: 'log',
|
||||
format: '%b %T: %m',
|
||||
terminal: true,
|
||||
},
|
||||
customLaunchers: {
|
||||
ChromeHeadless: {
|
||||
base: 'Chrome',
|
||||
flags: [
|
||||
'--no-sandbox',
|
||||
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
||||
'--headless',
|
||||
'--disable-gpu',
|
||||
// Without a remote debugging port, Google Chrome exits immediately.
|
||||
' --remote-debugging-port=9222',
|
||||
],
|
||||
},
|
||||
ChromeDebug: {
|
||||
base: 'Chrome',
|
||||
chromeDataDir: path.resolve(__dirname, '.chrome'),
|
||||
},
|
||||
SLChrome: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'chrome',
|
||||
platform: 'macOS 10.12',
|
||||
},
|
||||
SLFirefox: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'firefox',
|
||||
platform: 'macOS 10.12',
|
||||
},
|
||||
SLEdge: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'microsoftedge',
|
||||
},
|
||||
SLSafari: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'safari',
|
||||
platform: 'macOS 10.12',
|
||||
},
|
||||
SLInternetExplorer10: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'internet explorer',
|
||||
version: '10',
|
||||
platform: 'Windows 8',
|
||||
},
|
||||
SLInternetExplorer11: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'internet explorer',
|
||||
version: '11',
|
||||
platform: 'Windows 10',
|
||||
},
|
||||
SLiOS9: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'iphone',
|
||||
version: '9.3',
|
||||
platform: 'macOS 10.12',
|
||||
},
|
||||
SLChromeMobile: {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'Chrome',
|
||||
appiumVersion: '1.6.3',
|
||||
platformVersion: '7.0',
|
||||
platformName: 'Android',
|
||||
deviceName: 'Android GoogleAPI Emulator',
|
||||
},
|
||||
},
|
||||
preprocessors: {
|
||||
['./node_modules/test-utils/setup.js']: ['rollup'],
|
||||
['./node_modules/test-utils/utils/*.js']: ['rollup'],
|
||||
['./tests/**/*.js']: ['rollup'],
|
||||
},
|
||||
|
||||
rollupPreprocessor: {
|
||||
format: 'umd',
|
||||
sourceMap: 'inline',
|
||||
globals: {
|
||||
chai: 'chai',
|
||||
'popper-utils': 'PopperUtils',
|
||||
},
|
||||
external: ['chai', 'popper-utils'],
|
||||
plugins: [resolve(), babel(babelrc)],
|
||||
},
|
||||
files: [
|
||||
'./tests/styles/*.css',
|
||||
'./tests/functional/*.js',
|
||||
'./tests/unit/*.js',
|
||||
],
|
||||
sauceLabs: {
|
||||
testName: 'Popper.js',
|
||||
startConnect: false,
|
||||
recordVideo: true,
|
||||
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: './.tmp/coverage',
|
||||
reporters: [
|
||||
{ type: 'html', subdir: 'report-html' },
|
||||
{ type: 'lcov', subdir: 'report-lcov' },
|
||||
],
|
||||
},
|
||||
reporters: ['mocha', 'saucelabs', 'coverage'],
|
||||
};
|
||||
|
||||
config.set(configuration);
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "@popperjs/test",
|
||||
"version": "1.0.2",
|
||||
"description": "This package is a list of scripts used by Popper.js and Tooltip.js to test them.",
|
||||
"bin": {
|
||||
"popper-karma": "./bin/karma.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "exit 0"
|
||||
},
|
||||
"author": "Federico Zivolo <federico.zivolo@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"babel-core": "^6.24.1",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-istanbul": "^4.1.4",
|
||||
"babel-plugin-module-resolver": "^2.7.1",
|
||||
"babel-preset-minify": "^0.2.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"chai": "^4.0.1",
|
||||
"eslint": "^4.0.0",
|
||||
"eslint-plugin-jasmine": "^2.6.2",
|
||||
"gitignore-to-glob": "^0.3.0",
|
||||
"gzipped": "^0.0.5",
|
||||
"jasmine-core": "^2.6.2",
|
||||
"karma": "^1.7.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chrome-launcher": "^2.1.1",
|
||||
"karma-coverage": "^1.1.1",
|
||||
"karma-firefox-launcher": "^1.0.1",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-mocha-reporter": "^2.2.3",
|
||||
"karma-rollup-preprocessor": "^4.0.0",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-sauce-launcher": "^1.1.0",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"rollup": "^0.43.0",
|
||||
"rollup-plugin-babel": "^2.7.1",
|
||||
"rollup-plugin-node-resolve": "^3.0.0",
|
||||
"rollup-watch": "^4.0.0",
|
||||
"sinon": "^2.3.2",
|
||||
"yargs": "^8.0.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user