-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vs code extension testing #569
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
c9baeaa
Added initial set up for VS Code Plugin testing. Also added dependenc…
ivan-romanov 90e6f18
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
ivan-romanov 1bcc86d
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
ivan-romanov 2dad5f9
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
ivan-romanov 8e955a5
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
ivan-romanov ef3a5da
Updated runner to fix an issue with sleep
ivan-romanov dc1658e
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
ivan-romanov d2157eb
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
ivan-romanov f7b18f3
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
sinapsist 2c3a5e1
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
sinapsist 93362df
Polished runner and added set up and tear down parts. Also linked eac…
sinapsist 39585d5
Updated package-lock.json with new packages added to package.json
sinapsist 44e0936
Enable back clean up for test project folder
sinapsist 83d8662
Update package.json files to remove index.ts
sinapsist 6519879
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
sinapsist 4c1038b
Update package.json files to remove index.ts
sinapsist 9707082
Fixing tsconfig.json
sinapsist 3e03956
Updating package-lock
sinapsist f2aa712
Updated test
sinapsist 4ae24da
Fixing pipeline.
sinapsist 200cb44
Fixing pipeline.
sinapsist 02059ab
Fixing pipeline.
sinapsist dd5072d
Merge branch 'main' of https://github.com/ecadlabs/taqueria into vs-c…
sinapsist 9462dcd
rollback test
sinapsist d79d09d
update package-lock.json
sinapsist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as path from 'path'; | ||
|
||
import { runTests } from '@vscode/test-electron'; | ||
|
||
async function main() { | ||
try { | ||
// The folder containing the Extension Manifest package.json | ||
// Passed to `--extensionDevelopmentPath` | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../../out'); | ||
|
||
// The path to the extension test script | ||
// Passed to --extensionTestsPath | ||
const extensionTestsPath = path.resolve(__dirname, '../../out/test/suite/index'); | ||
|
||
// Download VS Code, unzip it and run the integration test | ||
await runTests({ extensionDevelopmentPath, extensionTestsPath }); | ||
} catch (err) { | ||
console.error('Failed to run tests'); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
43 changes: 43 additions & 0 deletions
43
taqueria-vscode-extension/src/test/suite/data/vscode-taq-test-project/.taq/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"language": "en", | ||
"plugins": [], | ||
"contractsDir": "contracts", | ||
"testsDir": "tests", | ||
"artifactsDir": "artifacts", | ||
"environment": { | ||
"default": "development", | ||
"development": { | ||
"networks": [], | ||
"sandboxes": [ | ||
"local" | ||
], | ||
"storage": {} | ||
} | ||
}, | ||
"sandbox": { | ||
"local": { | ||
"accounts": { | ||
"default": "bob", | ||
"bob": { | ||
"initialBalance": "3000000000" | ||
}, | ||
"alice": { | ||
"initialBalance": "2000000000" | ||
}, | ||
"john": { | ||
"initialBalance": "4000000000" | ||
}, | ||
"jane": { | ||
"initialBalance": "5000000000" | ||
}, | ||
"joe": { | ||
"initialBalance": "1000000000" | ||
} | ||
}, | ||
"label": "Local Tezos Sandbox", | ||
"protocol": "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx", | ||
"rpcUrl": "http://localhost:20000" | ||
} | ||
}, | ||
"network": {} | ||
} |
28 changes: 28 additions & 0 deletions
28
taqueria-vscode-extension/src/test/suite/data/vscode-taq-test-project/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
taqueria-vscode-extension/src/test/suite/data/vscode-taq-test-project/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "vscode-taq-test-project", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
} | ||
} |
214 changes: 214 additions & 0 deletions
214
...eria-vscode-extension/src/test/suite/data/vscode-taq-test-project/quickstart.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
## Overview | ||
|
||
This quickstart guide will teach you the fundamentals of using Taqueria in 10 minutes by going through the process of running some basic tasks in Taqueria from the CLI | ||
|
||
What you will accomplish: | ||
- Initialize a new Taqueria project | ||
- Install plugins for LIGO, Flextesa, and Taquito | ||
- Compile a LIGO smart contract | ||
- Start a local Flextesa sandbox | ||
- Originate the compiled smart contract to the sandbox | ||
|
||
## Requirements | ||
|
||
To successfully use Taqueria, you must ensure that: | ||
- The Taqueria CLI has been [installed](./installation.mdx) and is available in your `$PATH` | ||
- Docker v0.8 or later is installed and currently running | ||
- Node.js v16.x or later | ||
|
||
## Starting a Taqueria Project | ||
|
||
There are two things required to start using Taqueria on a project | ||
|
||
1. The project must be initialized by Taqueria. This process creates a hidden directory `./.taq` inside the project directory that contains the configuration and state files required by Taqueria, and ensures the required directories `/contracts`, `/artifacts`, and `/tests` have been created | ||
|
||
Taqueria provides the command `init` which will create a new directory with the correct structure and configuration. To create a new Taqueria project called `my-first-project`, run the command: | ||
```shell | ||
taq init my-first-project | ||
``` | ||
:::caution | ||
If a project has already been initialized, Taqueria will not re-initialize the project, but will still return a success message. This will be fixed in an upcoming release | ||
::: | ||
|
||
2. The project directory must be initialized as an NPM project as all current plugins implemented as NPM packages. To do this, run: | ||
```shell | ||
npm init -y | ||
``` | ||
|
||
## Working with Plugins | ||
|
||
Now that the project has been properly initialized, plugins can be installed to provide support for specific functionality such as compilation, smart contract origination, or sandbox environments | ||
|
||
Plugins are installed using the `taq install [pluginName]` command (requires the project to be initialized). Once a plugin has been installed, it's tasks will become available in Taqueria | ||
|
||
You can view the list of commands available in the current project context by running `taq` from the command line | ||
|
||
### Available Plugins | ||
|
||
| name | pluginName | description | | ||
|----------------|------------------------------ |---------------------------------------------------------------------| | ||
| LIGO | `@taqueria/plugin-ligo` | A compiler for the LIGO smart contract language | | ||
| SmartPy | `@taqueria/plugin-smartpy` | A compiler for the SmartPy contract language | | ||
| Flextesa | `@taqueria/plugin-flextesa` | A sandbox test network running Tezos Flextesa | | ||
| Taquito | `@taqueria/plugin-taquito` | A front-end Tezos framework used to originate | | ||
| Contract Types | `@taqueria/plugin-contract-types` | A type generator that produces TS types from Michelson code | | ||
| Tezos Client | `@taqueria/plugin-tezos-client` | Interacts with a Tezos node, providing simulation and type checking | | ||
|
||
## Compiling a LIGO Smart Contract | ||
|
||
To add support for the LIGO smart contract language, install the LIGO plugin by running: | ||
```shell | ||
taq install @taqueria/plugin-ligo | ||
``` | ||
|
||
Once installed, the plugin provides the command `taq compile` which when run, will look for any LIGO files in the `/contracts` directory and compile them to Michelson `.tz` files in the `/artifacts` directory | ||
|
||
To demonstrate this, create a file called `counter.jsligo` in the `/contracts` directory and insert the following JSLigo code: | ||
```ligo title="/contracts/counter.jsligo" | ||
type storage = int; | ||
|
||
type parameter = | ||
| ["Increment", int] | ||
| ["Decrement", int] | ||
| ["Reset"]; | ||
|
||
type return_ = [list <operation>, storage]; | ||
|
||
/* Two entrypoints */ | ||
let add = ([store, delta] : [storage, int]) : storage => store + delta; | ||
let sub = ([store, delta] : [storage, int]) : storage => store - delta; | ||
|
||
/* Main access point that dispatches to the entrypoints according to | ||
the smart contract parameter. */ | ||
let main = ([action, store] : [parameter, storage]) : return_ => { | ||
return [ | ||
(list([]) as list <operation>), // No operations | ||
(match (action, { | ||
Increment: (n: int) => add ([store, n]), | ||
Decrement: (n: int) => sub ([store, n]), | ||
Reset: () => 0})) | ||
] | ||
} | ||
``` | ||
|
||
You can now compile this contract by running the following command from the project directory: | ||
```shell | ||
taq compile | ||
``` | ||
|
||
Taqueria will then output a list of contracts compiled, and the artifacts created: | ||
```shell | ||
❯ taq compile | ||
┌────────────────┬──────────────────────┐ | ||
│ Contract │ Artifact │ | ||
├────────────────┼──────────────────────┤ | ||
│ counter.jsligo │ artifacts/counter.tz │ | ||
└────────────────┴──────────────────────┘ | ||
``` | ||
|
||
If you open this file (`/artifacts/counter.tz`), you can view the raw Michelson code which will later be originated to the sandbox: | ||
``` | ||
{ parameter (or (or (int %decrement) (int %increment)) (unit %reset)) ; | ||
storage int ; | ||
code { UNPAIR ; | ||
IF_LEFT { IF_LEFT { SWAP ; SUB } { ADD } } { DROP 2 ; PUSH int 0 } ; | ||
NIL operation ; | ||
PAIR } } | ||
``` | ||
|
||
### Starting a Flextesa Sandbox | ||
|
||
The next step is to install the Flextesa plugin which provides a local Tezos sandbox network: | ||
```shell | ||
taq install @taqueria/plugin-flextesa | ||
``` | ||
|
||
Once installed, the plugin provides three commands to start, stop, and query a sandbox: | ||
- `taq start sandbox [sandboxName]` | ||
- `taq stop sandbox [sandboxName]` | ||
- `taq list accounts [sandboxName]` | ||
|
||
:::note | ||
Sandboxes are configured in the project's Taqueria configuration file (`./.taq/config.json`). Each named sandbox configuration can then be called from the CLI. | ||
By default, every Taqueria project comes pre-configured with a sandbox named `local` | ||
::: | ||
|
||
Start up the sandbox named `local` by running: | ||
```shell | ||
taq start sandbox local | ||
``` | ||
|
||
To confirm the sandbox is running, query the sandbox for the account information: | ||
```shell | ||
taq list accounts local | ||
``` | ||
|
||
If successful, you will see a list of the accounts and balances specified in the `config.json` file that have been created on the Tezos blockchain in the sandbox: | ||
``` | ||
❯ taq list accounts local | ||
┌─────────┬─────────┬──────────────────────────────────────┐ | ||
│ Account │ Balance │ Address │ | ||
├─────────┼─────────┼──────────────────────────────────────┤ | ||
│ bob │ 3000 ꜩ │ tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6 │ | ||
├─────────┼─────────┼──────────────────────────────────────┤ | ||
│ alice │ 2000 ꜩ │ tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb │ | ||
├─────────┼─────────┼──────────────────────────────────────┤ | ||
│ john │ 4000 ꜩ │ tz1Zwoh1QCVAvJ4sVTojMp9pLYp6Ji4NoZy6 │ | ||
├─────────┼─────────┼──────────────────────────────────────┤ | ||
│ jane │ 5000 ꜩ │ tz1aHUAC4oviwJuZF1EvVSvFz7cu9KMNYBph │ | ||
├─────────┼─────────┼──────────────────────────────────────┤ | ||
│ joe │ 1000 ꜩ │ tz1MVGjgD1YtAPwohsSfk8i3ZiT1yEGM2YXB │ | ||
└─────────┴─────────┴──────────────────────────────────────┘ | ||
``` | ||
|
||
### Originating a Contract with Taquito | ||
|
||
With a sandbox now running, the next step is to originate the `counter.tz` file to the sandbox network using the Taquito plugin | ||
|
||
First, install the plugin: | ||
```shell | ||
taq install @taqueria/plugin-taquito | ||
``` | ||
|
||
Next, you need to configure some values for origination: | ||
- The initial storage for the smart contract | ||
- The name of the sandbox to target (by default it is pre-configured to the sandbox named `local`) | ||
:::note | ||
As the default configuration comes with the sandbox named `local` preconfigured, simply provide a value for the initial storage in the `"storage"` property | ||
::: | ||
|
||
To set these values in Taqueria, navigate to the file `./.taq/config.json` and locate the `"environment"` property. For the `counter.tz` contract, simply need to provide an integer value for the `counter.tz` file which looks like this: | ||
``` | ||
"environment": { | ||
"default": "development", | ||
"development": { | ||
"networks": [], | ||
"sandboxes": [ | ||
"local" | ||
], | ||
"storage": { | ||
"counter.tz": 42 | ||
} | ||
} | ||
}, | ||
``` | ||
|
||
Now you can originate the contract by running: | ||
```shell | ||
taq originate | ||
``` | ||
|
||
This will originate all contracts in the `/artifacts` directory to the sandbox and return the address of the deployed contract and destination sandbox. The output for this command will display which contracts were originated, what the destination was, and what the on-chain address for the deployed address is. This will look something like this: | ||
``` | ||
┌────────────┬──────────────────────────────────────┬─────────────┐ | ||
│ Contract │ Address │ Destination │ | ||
├────────────┼──────────────────────────────────────┼─────────────┤ | ||
│ counter.tz │ KT1Ayz8qos7G4U3Jucp6QWoM7ayhbShNXcat │ local │ | ||
└────────────┴──────────────────────────────────────┴─────────────┘ | ||
``` | ||
|
||
## Finishing Up | ||
|
||
Congratulations! At this point, you have run through the basic usage of Taqueria | ||
|
||
For more details on the usage of specific Taqueria tasks, you can refer to the plugin documentation which contains additional context, configuration, and usage of the many Taqueria tasks; or continue on with the getting started guides |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this file be removed?