Skip to content

Commit

Permalink
Split Tests into Unit / Perf and update all active tests to use commo…
Browse files Browse the repository at this point in the history
…n test project (#1606)
  • Loading branch information
MSNev committed Jul 9, 2021
1 parent 16a4284 commit fd67558
Show file tree
Hide file tree
Showing 118 changed files with 525 additions and 75,276 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion common/Tests/Framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"magic-string": "^0.25.7"
},
"dependencies": {
"@microsoft/applicationinsights-shims" : "2.0.0",
"@microsoft/dynamicproto-js": "^1.1.4"
}
}
2 changes: 1 addition & 1 deletion common/Tests/Framework/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"target": "es5",
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noEmitHelpers": true,
"noEmitHelpers": false,
"skipLibCheck": true,
"alwaysStrict": true,
"declaration": true,
Expand Down
10 changes: 10 additions & 0 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
"ignoreMissingScript": false,
"allowWarningsInSuccessfulBuild": true
},
{
"commandKind": "bulk",
"name": "perftest",
"summary": "Run all performance based tests for all packages",
"description": "Runs performance tests for all projects",
"safeForSimultaneousRushProcesses": false,
"enableParallelism": false,
"ignoreMissingScript": true,
"allowWarningsInSuccessfulBuild": true
},
{
"commandKind": "bulk",
"name": "lint",
Expand Down
72 changes: 36 additions & 36 deletions common/config/rush/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as pako from "pako";

export class AnalyticsExtensionSizeCheck extends AITestClass {
private readonly MAX_DEFLATE_SIZE = 20;
private readonly rawFilePath = "../../dist/applicationinsights-analytics-js.min.js";
private readonly prodFilePaath = "../../browser/applicationinsights-analytics-js.min.js"
private readonly rawFilePath = "../dist/applicationinsights-analytics-js.min.js";
private readonly prodFilePaath = "../browser/applicationinsights-analytics-js.min.js"

public testInitialize() {
}
Expand All @@ -31,7 +31,7 @@ export class AnalyticsExtensionSizeCheck extends AITestClass {
private _fileSizeCheck(isProd: boolean): void {
let _filePath = isProd? this.prodFilePaath : this.rawFilePath;
let postfix = isProd? "" : "-raw";
let fileName = _filePath.split("..")[2];
let fileName = _filePath.split("..")[1];
this.testCase({
name: `Test applicationinsights-analytics-extension${postfix} deflate size`,
test: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { ITelemetryItem, AppInsightsCore, IPlugin, IConfiguration, IAppInsightsCore, setEnableEnvMocks, getLocation, dumpObj } from "@microsoft/applicationinsights-core-js";
import { Sender } from "@microsoft/applicationinsights-channel-js"
import { PropertiesPlugin } from "@microsoft/applicationinsights-properties-js";
import { ApplicationInsights } from "../src/JavaScriptSDK/ApplicationInsights";
import { ApplicationInsights } from "../../../src/JavaScriptSDK/ApplicationInsights";

declare class ExceptionHelper {
capture: (appInsights:IAppInsights) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TelemetryItemCreator,
IPageViewTelemetry
} from '@microsoft/applicationinsights-common';
import { ApplicationInsights } from '../src/JavaScriptSDK/ApplicationInsights'
import { ApplicationInsights } from '../../../src/JavaScriptSDK/ApplicationInsights'
import {
IAppInsightsCore, AppInsightsCore,
ITelemetryItem,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ApplicationInsightsTests } from './ApplicationInsights.tests';
import { TelemetryItemCreatorTests } from './TelemetryItemCreator.tests';
import { AnalyticsExtensionSizeCheck } from "./AnalyticsExtensionSize.tests";

export function runTests() {
new ApplicationInsightsTests().registerTests();
new TelemetryItemCreatorTests().registerTests();
new AnalyticsExtensionSizeCheck().registerTests();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<meta charset="utf-8">
<meta http-equiv="Cache-control" content="no-Cache" />
<title>Tests for Application Insights JavaScript Analytics Extension</title>
<link rel="stylesheet" href="../../../../common//Tests//External/qunit-1.23.1.css">
<script src="../../../../common/Tests/Selenium/ExceptionHelper.js"></script>
<link rel="stylesheet" href="../../../common/Tests//External/qunit-1.23.1.css">
<script src="../../../common/Tests/Selenium/ExceptionHelper.js"></script>
<!-- <script src="http://sinonjs.org/releases/sinon-2.3.8.js" crossorigin="anonymous"></script> -->
<script src="../../../../common/Tests/External/sinon-7.3.1.js"></script> -->
<script src="../../../common/Tests/External/sinon-7.3.1.js"></script> -->
<!-- <script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.js" crossorigin="anonymous"></script> -->
<script src="../../../../common/Tests/External/require-2.2.0.js"></script>
<script src="../../../../common/Tests/Selenium/ModuleLoader.js"></script>
<script src="../../../../common/Tests/Selenium/SimpleSyncPromise.js"></script>
<script src="../../../common/Tests/External/require-2.2.0.js"></script>
<script src="../../../common/Tests/Selenium/ModuleLoader.js"></script>
<script src="../../../common/Tests/Selenium/SimpleSyncPromise.js"></script>

<script>
var modules = new ModuleLoader({
baseUrl: '../../',
baseUrl: '../',
paths: {
qunit: "../../common/Tests/External/qunit-1.23.1",
"whatwg-fetch": "../../common/Tests/External/whatwg-fetch.3.0.0"
Expand Down Expand Up @@ -50,7 +50,7 @@
// Load Properties
modules.add("@microsoft/applicationinsights-properties-js", "./node_modules/@microsoft/applicationinsights-properties-js/browser/applicationinsights-properties-js");

var testModule = modules.add("Tests/Selenium/appinsights-analytics.tests", "./appinsights-analytics.tests.js")
var testModule = modules.add("Tests/Unit/src/appinsights-analytics.tests", "./Unit/dist/appinsights-analytics.tests.js")
testModule.run = function (tests) {
console && console.log("Starting tests");
QUnit.start();
Expand Down
Loading

0 comments on commit fd67558

Please sign in to comment.