1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/npm/tasks/test.yml
Xavier Cambar cea681a5c0 npm module compatible with npm5 (#26582)
* npm module compatible with npm5

Uses the `--long` flag in `npm list` to get the `missing` key back.

* npm: add integration tests

* npm: test the module with npm 4 as well

* Remove debug tasks, use variables

* Use tests instead of filters

* Adds xcambar as a maintainer of the npm module
2018-01-19 15:47:43 +01:00

69 lines
1.8 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- name: 'Remove any node modules'
file:
path: '{{ remote_dir }}/node_modules'
state: absent
- vars:
# sample: node-v8.2.0-linux-x64.tar.xz
node_path: '{{ remote_dir }}/{{ nodejs_path }}/bin'
package: 'iconv-lite'
block:
- shell: npm --version
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
register: npm_version
- debug:
var: npm_version.stdout
- name: 'Install simple package without dependency'
npm:
path: '{{ remote_dir }}'
executable: '{{ node_path }}/npm'
state: present
name: '{{ package }}'
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
register: npm_install
- assert:
that:
- npm_install is success
- npm_install is changed
- name: 'Reinstall simple package without dependency'
npm:
path: '{{ remote_dir }}'
executable: '{{ node_path }}/npm'
state: present
name: '{{ package }}'
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
register: npm_reinstall
- name: Check there is no change
assert:
that:
- npm_reinstall is success
- not (npm_reinstall is changed)
- name: 'Manually delete package'
file:
path: '{{ remote_dir }}/node_modules/{{ package }}'
state: absent
- name: 'reinstall simple package'
npm:
path: '{{ remote_dir }}'
executable: '{{ node_path }}/npm'
state: present
name: '{{ package }}'
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
register: npm_fix_install
- name: Check result is changed and successful
assert:
that:
- npm_fix_install is success
- npm_fix_install is changed