BREAKING CHANGE(core): switch to ESM

This commit is contained in:
2022-04-18 22:16:46 +02:00
parent bc79a9ae42
commit 216eabe035
11 changed files with 15731 additions and 2125 deletions

View File

@ -2,6 +2,7 @@
"name": "testpackage",
"version": "1.0.0",
"description": "some test",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/someuser/somerepo.git"

View File

@ -1,31 +1,33 @@
import { tap, expect } from '@pushrocks/tapbundle';
import projectinfo = require('../ts/index');
import * as smartpath from '@pushrocks/smartpath';
import * as projectinfo from '../ts/index.js';
let path = require('path');
let testBasePath = path.resolve(__dirname);
import * as path from 'path';
let testBasePath = path.resolve(smartpath.get.dirnameFromImportMetaUrl(import.meta.url));
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
tap.test('should have .packageJson', async () => {
expect(myNpm.packageJson).have.property('version', '1.0.0');
expect(myNpm.packageJson).have.property('name', 'testpackage');
expect(myNpm.packageJson).property('version').toEqual('1.0.0');
expect(myNpm.packageJson).property('name').toEqual('testpackage');
});
tap.test('should have .version', async () => {
expect(myNpm).have.property('version', '1.0.0');
expect(myNpm).property('version').toEqual('1.0.0');
});
tap.test('should have .name', async () => {
expect(myNpm).have.property('name', 'testpackage');
expect(myNpm).property('name').toEqual('testpackage');
});
tap.test('should have .license', async () => {
expect(myNpm).have.property('license', 'MIT');
expect(myNpm).property('license').toEqual('MIT');
});
tap.test('should have .git', async () => {
expect(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git');
expect(myNpm.git.httpsUrl).toEqual('https://sometoken@github.com/someuser/somerepo.git');
});
tap.test('should return a name', async () => {
expect(projectinfo.getNpmNameForDir(testBasePath)).equal('testpackage');
expect(projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage');
});
tap.start();