Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Clean up Browserstack test files, remove unused files #788

Merged
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ node_modules/
test-bundle.js
out/
test/reports
test/cross-browser-testing/reports
test/test-bundle.js.map
test/stub/test-stub-bundle.js
**/dist
test/cross-browser-testing/browserstack/reports
test/cross-browser-testing/browserstack/reports
browserstack.err
local.log
23,599 changes: 7,410 additions & 16,189 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"build:webpack:module": "webpack --config test/integrations/module/webpack/webpack.config.js",
"build:ts": "tsc -p .",
"test": "npm run build && npm run build:test-bundle && cross-env DEBUG=false karma start test/karma.config.js",
"test:browserstack": "karma start test/cross-browser-testing/browserstack/browserstack.karma.config.js",
"test:browserstack:debug": "cross-env DEBUG=true karma start test/cross-browser-testing/browserstack/browserstack.karma.config.js",
"test:browserstack": "karma start test/cross-browser-testing/browserstack.karma.config.js",
"test:browserstack:debug": "cross-env DEBUG=true karma start test/cross-browser-testing/browserstack.karma.config.js",
"test:debug": "cross-env DEBUG=true karma start test/karma.config.js",
"test:stub": "cross-env TESTTYPE=stub ENVIRONMENT=prod rollup --config rollup.test.config.js && karma start test/stub/karma.stub.config.js",
"test:integrations": "npm run test:requirejs && npm run test:integrations:cjs && npm run test:integrations:module",
Expand Down
97 changes: 97 additions & 0 deletions test/cross-browser-testing/browserstack.karma.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
const { DEBUG } = process.env;

const files = [
'../lib/geomock.js',
'../../node_modules/fetch-mock/dist/es5/client-bundle.js',
'../../dist/mparticle.js',
// TODO: the current test suite includes modern syntax which run successfully
// on newer browsers. We will need to transpile tests to work with older
// browsers - go.mparticle.com/work/SQDSDKS-5834
'../test-bundle.js',
];

let captureConsole = false;
let browserConsoleLogOptions = {};

// Allows console logs to appear when doing npm run test:debug
if (DEBUG === 'true') {
browserConsoleLogOptions = {
level: 'log',
format: '%b %T: %m',
terminal: true,
};
captureConsole = true;
} else {
browserConsoleLogOptions = {
terminal: false,
};
}

const customLaunchers = {
// These 2 browsers pass because they are capable of running ES6 syntax
// Our tests currently have ES6 syntax in them. They need to be transpiled
bs_firefox_mac_100: {
base: 'BrowserStack',
browser: 'firefox',
browser_version: '100.0',
os: 'OS X',
os_version: 'Ventura'
},
bs_chrome_mac_100: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: '100.0',
os: 'OS X',
os_version: 'Ventura'
},
// These two browsers fail because they cannot run ES6 syntax.
// Our tests have some ES6 syntax in them, so we need to transpile the tests
// to get them to run properly.
// bs_firefox_mac_21: {
// base: 'BrowserStack',
// browser: 'firefox',
// browser_version: '21.0',
// os: 'OS X',
// os_version: 'Snow Leopard'
// },
// bs_chrome_mac_38: {
// base: 'BrowserStack',
// browser: 'chrome',
// browser_version: '38.0',
// os: 'OS X',
// os_version: 'Mojave'
// },
}

module.exports = function(config) {
config.set({
browserStack: {
username: process.env.BS_USERNAME,
accessKey: process.env.BS_ACCESS_KEY
},
autoWatch: false,
customLaunchers,
browsers: Object.keys(customLaunchers),
frameworks: ['mocha', 'should'],
files,
reporters: ['progress', 'junit'],
colors: true,
singleRun: true,
debug: true,
logLevel: config.LOG_INFO,
browserConsoleLogOptions,
client: {
captureConsole,
},
junitReporter: {
outputDir: 'reports/',
outputFile: 'test-karma.xml',
},
// These settings are added because the connection to Browserstack
// can sometimes be unstable, requiring re-connections, or a longer than
// 2000 ms (default) timeout
browserDisconnectTimeout: 50000,
browserDisconnectTolerance: 5,
concurrency: 5,
});
};

This file was deleted.

5 changes: 1 addition & 4 deletions test/karma.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
const { DEBUG } = process.env;

let files = [
'lib/mockhttprequest.js',
const files = [
'lib/geomock.js',
'../node_modules/fetch-mock/dist/es5/client-bundle.js',
'../node_modules/sinon-browser-only/sinon.js',
'config.js',
'../dist/mparticle.js',
'test-bundle.js',
];
Expand Down
13 changes: 0 additions & 13 deletions test/runner.js

This file was deleted.

53 changes: 26 additions & 27 deletions test/src/tests-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,30 @@ afterEach(function() {
window.fetchMock.restore();
});

import '../cross-browser-testing/test-cross-browser';
import './tests-core-sdk';
// import './tests-batchUploader';
// import './tests-beaconUpload';
// import './tests-kit-blocking';
// import './tests-persistence';
// import './tests-forwarders';
// import './tests-helpers';
// import './tests-identity';
// import './tests-event-logging';
// import './tests-eCommerce';
// import './tests-cookie-syncing';
// import './tests-identities-attributes';
// import './tests-native-sdk';
// import './tests-consent';
// import './tests-serverModel';
// import './tests-mockBatchCreator.ts';
// import './tests-mParticleUser';
// import './tests-self-hosting-specific';
// import './tests-runtimeToBatchEventsDTO';
// import './tests-apiClient';
// import './tests-mparticle-instance-manager';
// import './tests-queue-public-methods';
// import './tests-validators';
// import './tests-utils';
// import './tests-session-manager';
// import './tests-store';
// import './tests-config-api-client';
import './tests-batchUploader';
import './tests-beaconUpload';
import './tests-kit-blocking';
import './tests-persistence';
import './tests-forwarders';
import './tests-helpers';
import './tests-identity';
import './tests-event-logging';
import './tests-eCommerce';
import './tests-cookie-syncing';
import './tests-identities-attributes';
import './tests-native-sdk';
import './tests-consent';
import './tests-serverModel';
import './tests-mockBatchCreator.ts';
import './tests-mParticleUser';
import './tests-self-hosting-specific';
import './tests-runtimeToBatchEventsDTO';
import './tests-apiClient';
import './tests-mparticle-instance-manager';
import './tests-queue-public-methods';
import './tests-validators';
import './tests-utils';
import './tests-session-manager';
import './tests-store';
import './tests-config-api-client';
Loading