Skip to content

Commit

Permalink
ci: Clean up Browserstack test files, remove unused files (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmi22186 committed Oct 24, 2023
1 parent b63610b commit c3a125d
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 38,158 deletions.
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/integrations/requirejs/test-requirejs-bundle.js
test/integrations/requirejs/test-requirejs-bundle.js
browserstack.err
local.log
38,039 changes: 0 additions & 38,039 deletions package-lock.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"build:rollup:requirejs": "rollup --config test/integrations/requirejs/rollup.requirejs.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.

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

let files = [
'lib/mockhttprequest.js',
const files = [
'lib/geomock.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.

52 changes: 26 additions & 26 deletions test/src/tests-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@ beforeEach(function() {
});

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';

0 comments on commit c3a125d

Please sign in to comment.