Skip to content

Commit

Permalink
prepared test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
r0light committed Apr 15, 2024
1 parent 66da733 commit c034660
Show file tree
Hide file tree
Showing 9 changed files with 3,620 additions and 607 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dist

## ts
built
.tsimp

## Editors:
# WinEdt
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,17 @@ The application uses:

The totypa (TOSCA Typescript parser) library provides Typescript type definitions for the TOSCA standard and parsers for generating Javascript objects out of TOSCA Profile definitions so that they can be used within the app.

To be able to directly run Typescript files, install `ts-node`:
To be able to directly run Typescript files, install `tsx`:

```sh
npm install -g ts-node
npm install tsx
```

*Note: this installs ts-node globally on your system, if you do not want that, look for local installation possibilites.*

Then run the profileParser in the following way:

```sh
cd src/totypa/parsers
ts-node profileParser.ts
npx tsx profileParser.ts
```

## Modifying and extending the quality model
Expand Down Expand Up @@ -81,5 +79,5 @@ To generate a markdown representation of the quality model (based on [src/core/q

```sh
cd src/core/qualitymodel
ts-node exportToMarkdown.ts
npx tsx exportToMarkdown.ts
```
4,185 changes: 3,590 additions & 595 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dev": "vite",
"build": "vite build",
"ghpages": "vite build --base=/",
"preview": "vite preview"
"preview": "vite preview",
"test": "ava"
},
"dependencies": {
"backbone": "^1.5.0",
Expand All @@ -18,6 +19,8 @@
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"mermaid": "^10.7.0",
"tsimp": "^2.0.11",
"tsx": "^4.7.2",
"uuid": "^9.0.1",
"vue": "^3.3.4",
"vue-class-component": "^8.0.0-0",
Expand All @@ -32,12 +35,24 @@
"@types/node": "^18.19.10",
"@vitejs/plugin-vue": "^4.6.2",
"@vue/tsconfig": "^0.1.3",
"ava": "^6.1.2",
"jsdom": "^20.0.3",
"sass": "^1.70.0",
"sass-loader": "^12.6.0",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vitest": "^1.2.2",
"vue-tsc": "^0.40.13"
},
"ava": {
"files": [
"tests/**/*"
],
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--import=tsimp"
]
}
}
2 changes: 0 additions & 2 deletions src/modeling/ModelingApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,6 @@ function onSvgExportRequested() {
// also remove all images (problematic because they reference another file which is not available after export)
toDelete.push(...Array.from(svgElement.getElementsByTagName("image")).filter(element => element.getAttribute("id")).map(element => element.getAttribute("id")));
console.log(toDelete);
for (const idToDelete of toDelete) {
if (svgElement.getElementById(idToDelete)) {
svgElement.getElementById(idToDelete).remove();
Expand Down
2 changes: 1 addition & 1 deletion src/totypa/parsedProfiles/cna_modeling_tosca_profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export const cna_modeling_tosca_profile: TOSCA_Service_Template = {
"capability": "cna.qualityModel.capabilities.Proxy",
"node": "cna.qualityModel.entities.BackingService",
"relationship": "cna.qualityModel.relationships.ProxiedBy.BackingService",
"ocurrences": [
"occurrences": [
0,
1
]
Expand Down
5 changes: 5 additions & 0 deletions tests/init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import test from 'ava';

test('test setup', t => {
t.pass();
});
2 changes: 1 addition & 1 deletion tosca-profiles/cna-modeling-tosca-profile/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ node_types:
capability: cna.qualityModel.capabilities.Proxy
node: cna.qualityModel.entities.BackingService
relationship: cna.qualityModel.relationships.ProxiedBy.BackingService
ocurrences: [0,1]
occurrences: [0,1]

cna.qualityModel.entities.Service:
derived_from: cna.qualityModel.entities.Component
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
"scripthost"
]
},
/*
"ts-node": {
// Tell ts-node CLI to install the --loader automatically
"esm": true,
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node",
}
},
},*/
"include": [
"src/**/*.ts",
"src/**/*.tsx",
Expand Down

0 comments on commit c034660

Please sign in to comment.