diff --git a/test/package.json b/test/package.json index e8d86a6..6feee04 100644 --- a/test/package.json +++ b/test/package.json @@ -13,5 +13,6 @@ "mocha": "^11.7.5", "selenium-webdriver": "^4.40.0", "superagent": "^10.3.0" - } + }, + "type": "module" } diff --git a/test/test.js b/test/test.js index 097c558..06fe8eb 100644 --- a/test/test.js +++ b/test/test.js @@ -1,19 +1,16 @@ #!/usr/bin/env node +import 'chromedriver'; +import { execSync } from 'node:child_process'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import superagent from 'superagent'; +import { Builder, By, Key, until } from 'selenium-webdriver'; +import { Options } from 'selenium-webdriver/chrome'; + /* global it, xit, describe, before, after, afterEach */ -'use strict'; - -require('chromedriver'); - -const execSync = require('child_process').execSync, - assert = require('node:assert/strict'), - fs = require('fs'), - path = require('path'), - superagent = require('superagent'), - { Builder, By, Key, until } = require('selenium-webdriver'), - { Options } = require('selenium-webdriver/chrome'); - const admin_username = 'admin', admin_password = 'changeme'; if (!process.env.USERNAME || !process.env.PASSWORD) { @@ -26,7 +23,7 @@ describe('Application life cycle test', function () { const LOCATION = process.env.LOCATION || 'test'; const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000; - const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; + const EXEC_ARGS = { cwd: path.resolve(import.meta.dirname, '..'), stdio: 'inherit' }; const USERNAME = process.env.USERNAME; const PASSWORD = process.env.PASSWORD;