refactor: migrate to ESM (#7331)

* refactor: move package.json to type: module

this is where the fun begins

* chore: move webpack common and prod to esm

* chore: move webpack to esm, eslint to explicit cjs

* refactor: migrate all files to esm

* style: lint

* refactor: begin moving karma to cjs, use dynamic esm import

* refactor: move index-test to cjs

* refactor: begin moving e2e to ESM

this was manual. I'm committing this because I'm about to try the `cjstoesm` tool

* refactor: move all to esm

* fix: make all e2e tests use .js imports

* refactor: begin moving exports to esm

* refactor: use URL transforms instead of __dirname

* fix: use libraryExport: default to properly handle openmct

* fix: export all playwright configs as modules

* refactor: move all instances of __dirname to import.meta.url

* refactor: lint, drop unnecessary URL call

* fix: use correct URL path on helper/addNoneditableObject.js

* fix: more incorrect URL resolve issues

* fix: parse json after reading it
This commit is contained in:
Tristan F
2024-01-02 10:24:22 -05:00
committed by GitHub
parent 68e60e332e
commit fce98a1c47
485 changed files with 1220 additions and 1190 deletions

View File

@ -19,19 +19,19 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
/*
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
suite is sharing state between tests which is considered an anti-pattern. Implementing in this way to
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
*/
const { test, expect } = require('../../../../pluginFixtures.js');
const {
import { fileURLToPath } from 'url';
import {
createDomainObjectWithDefaults,
createExampleTelemetryObject
} = require('../../../../appActions');
const path = require('path');
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
let conditionSetUrl;
let getConditionSetIdentifierFromUrl;
@ -50,7 +50,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
//Save localStorage for future test execution
await context.storageState({
path: path.resolve(__dirname, '../../../../test-data/recycled_local_storage.json')
path: fileURLToPath(
new URL('../../../../test-data/recycled_local_storage.json', import.meta.url)
)
});
//Set object identifier from url
@ -63,7 +65,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
//Load localStorage for subsequent tests
test.use({
storageState: path.resolve(__dirname, '../../../../test-data/recycled_local_storage.json')
storageState: fileURLToPath(
new URL('../../../../test-data/recycled_local_storage.json', import.meta.url)
)
});
//Begin suite of tests again localStorage